1.安装操作系统,保证联网环境,本文以CentOS 6.8为操作系统(略)
2.wget下载安装包(以5.3.3为例)
#mkdir /usr/cdh ---新建cm安装目录
#cd /usr/cdh ---切换目录
#wget 获取下载链接文件到本地服务器
#wget http://archive.cloudera.com/cm5/cm/5/cloudera-manager-el6-cm5.3.3_x86_64.tar.gz
#wget http://archive.cloudera.com/cdh5/parcels/5.3.3/CDH-5.3.3-1.cdh5.3.3.p0.5-el6.parcel
#wget http://archive.cloudera.com/cdh5/parcels/5.3.3/CDH-5.3.3-1.cdh5.3.3.p0.5-el6.parcel.sha1
#wget http://archive.cloudera.com/cdh5/parcels/5.3.3/manifest.json
#mv CDH-5.3.3-1.cdh5.3.3.p0.5-el6.parcel.sha1 CDH-5.3.3-1.cdh5.3.3.p0.5-el6.parcel.sha ---重命名.sha1
#mkdir /opt/cloudera/parcel-repo ---新建集群包安装目录
#mv CDH-5.3.3-1.cdh5.3.3.p0.5-el6.parcel /opt/cloudera/parcel-repo --移动文件到集群包安装目录下
#mv CDH-5.3.3-1.cdh5.3.3.p0.5-el6.parcel.sha /opt/cloudera/parcel-repo ---同上
#mv manifest.json /opt/cloudera/parcel-repo ---同上
#tar zxvf cloudera-manager-el6-cm5.3.3_x86_64.tar.gz ---解压
3.主节点与从节点修改配置(以三个节点为例子)
3.1 vim /etc/sysconfig/network(配置主机名)
NETWORKING=yes HOSTNAME=master(备注:从节点改为对应的名字,如slave1)
3.2 vim /etc/hosts (配置主机名与IP地址映射)
192.168.1.126 master
192.168.1.127 slave1
192.168.1.128 slave2
3.3 安装JDK1.7(本文推荐二进制包安装,不推荐命令安装,操作略)
3.4 关闭防火墙和SELinux
#service iptables stop ---停止防火墙服务
#chkconfig iptables off ---永久停止防火墙服务
#vim /etc/selinux/config ---修改SELinux配置
SELINUX=disabled
#保存退出
#setenforce 0 ---立即生效
3.5 配置时间同步
#yum -y install ntp ---安装ntp
#ntpdate -u ntp1.aliyun.com ---配置阿里云时钟
#vim /etc/ntp.conf
server ntp1.aliyun.com prefer
#保存退出
#service ntpd start ---开启ntpd服务
#chkconfig ntpd on ---ntpd自启动
3.6 主节点添加scm用户
useradd --system --home=/usr/cdh/cm-5.3.3/run/cloudera-scm-server/
--no-create-home --shell=/bin/false --comment "Cloudera SCM User"
cloudera-scm
3.7 配置ssh无密登录
在 master机器生成公钥文件
#ssh-keygen -t rsa
#cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
#chmod 600 ~/.ssh/authorized_keys
#拷贝到其他主机上
#scp ~/.ssh/authorized_keys root@slave1:~/.ssh/
#scp ~/.ssh/authorized_keys root@slave2:~/.ssh/
#ssh slave1
#ssh slave2
4.主节点安装mysql
#yum -y install mysql* ---安装所有mysql组件
#service mysqld start ---开启mysqld服务
#chkconfig mysqld on ---mysqld自启动
#mysql(无密登录)
#create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci; (创建数据库hive)
#grant all privileges on *.* to 'root'@'master' identified by 'mysql005' with grant option; (授予权限)
#grant all privileges on *.* to 'root'@'%' identified by 'mysql005' with grant option; (同上)
#grant all privileges on *.* to 'root'@localhost identified by 'mysql005' with grant option; (同上)
#flush privileges
#exit
5.安装cm5
5.1 拷贝mysql连接库到cm对应的目录下
#cp mysql-connector-java-5.1.30.jar /usr/cdh/cm-5.3.3/share/cmf/lib/
5.2 拷贝cm-5.3.3目录所有文件到各个节点
#scp -r /usr/cdh/cm-5.3.3 root@slave1:/usr/cdh/
#scp -r /usr/cdh/cm-5.3.3 root@slave2:/usr/cdh/
5.3 各个节点修改主机名(可忽略)
vim /usr/cdh/cm-5.3.3/etc/cloudera-scm-agent/config.ini
server_host=master
5.4 初始化cm数据库
#/usr/cdh/cm-5.3.3/share/cmf/schema/scm_prepare_database.sh mysql cm -hlocalhost -uroot -pmysql005 --scm-host localhost scm scm scm
5.5 在master(namenode)主节点启动
#/usr/cdh/cm-5.3.3/etc/init.d/cloudera-scm-server start
#/usr/cdh/cm-5.3.3/etc/init.d/cloudera-scm-agent start
5.6 在slave(datanode)所有从节点启动
#/usr/cdh/cm-5.3.3/etc/init.d/cloudera-scm-agent start
5.7 登录cm系统进行集群安装
#http://192.168.1.126:7180/cmf/login ---用户和密码都是 admin
#echo 0 > /proc/sys/vm/swappiness (交换值默认为60)
#如果系统安装有tomcat,请修改8005端口(sqoop限制)
#第一步选择免费版本,选择所有节点安装
#第二步等待下载、分配、激活,选择parcel进行安装
#第三步拷贝mysql连接库到hive/lib下
#cp /usr/cdh/cm-5.3.3/share/cmf/lib/mysql-connector-java-5.1.30.jar
/opt/cloudera/parcels/CDH-5.3.3-1.cdh5.3.3.p0.5/lib/hive/lib/
#第四步默认设置,主机检查,然后下一步开启所有服务20分钟后即可安装完成。
#注销,重新登录即可。