环境:三台centos7
master:IP:192.168.210.6
slave1:IP:192.168.210.7
slave2:IP:192.168.210.8
相关软件包:
JKD:1.8 下载地址Oracle官网:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Cloudera Manager地址:http://archive.cloudera.com/cm5/cm/5/ 我是下载的cloudera-manager-centos7-cm5.13.0_x86_64.tar.gz
CDH安装包地址:http://archive.cloudera.com/cdh5/parcels/5.13/ 7版本下载的是CDH-5.13.0-1.cdh5.13.0.p0.29-el7.parcel CDH-5.13.0-1.cdh5.13.0.p0.29-el7.parcel.sha1 manifest.json
java-mysql连接jar包:http://central.maven.org/maven2/mysql/mysql-connector-java/8.0.7-dmr/ 我下的是mysql-connector-java-8.0.7-dmr.jar
这样看是六个包,然后上传到服务器上
[root@master ~]# mv CDH-5.13.0-1.cdh5.13.0.p0.29-el7.parcel.sha1 CDH-5.13.0-1.cdh5.13.0.p0.29-el7.parcel.sha
环境准备:
1、修改主机名和hosts (每台机器都要)
[root@master ~]# hostnamectl set-hostname master
[root@slave1 ~]# hostnamectl set-hostname slave1
[root@slave2 ~]# hostnamectl set-hostname slave2
[root@master ~]# cat /etc/hosts //另外两个节点同理
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.210.6 master
192.168.210.7 slave1
192.168.210.8 slave2
2、设置ssh密钥登陆 (每台机器都需要)
[root@master ~]# ssh-keygen -t rsa //三次回车即可
[root@master ~]# ssh-copy-id 192.168.210.7 //输入yes 和192.168.210.7的root密码 其他节点操作同样,实现无密码登陆,后期有需要
[root@master ~]# ssh root@192.168.210.7 //实验一下 不需要密码成功登陆则成功
3、安装JDK (每台机器都要)
[root@master ~]# rpm -qa |grep java
[root@master ~]# rpm -e --nodeps packageName //如有可进行卸载
[root@master ~]# tar -zxvf jdk-8u131-linux-x64.tar.gz -C /usr/local/
[root@master ~]# vim /etc/profile //配置Java环境变量
export JAVA_HOME=/usr/local/jdk1.8.0_131
export JAVA_BIN=/usr/local/bin/jdk1.8.0_131
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH
[root@master ~]# source /etc/profile
[root@master ~]# java -version //JDK安装成功
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
4、关闭selinux和firewalld (每台机器都需要)
[root@master ~]# setenforce 0 //临时关闭
[root@master ~]# vim /etc/selinux/config
SELINUX=enforcing更改为SELINUX=permissive(或者disabled)
[root@master ~]# systemctl stop firewalld
[root@master ~]# systemctl disable firewalld
5、NTP服务器设置(用于不同节点间实现时间同步,每台都要做)
[root@master ~]# yum -y install ntp
[root@master ~]# vim /etc/ntp.conf
[root@master ~]# systemctl enable ntpd
[root@master ~]# systemctl restart ntpd
[root@master ~]# ntpdate -u 2.pool.ntp.org //同步一下时间
//表示成功,每台都同步一下
[root@master ~]# hwclock --systohc //同步系统时钟 (以防止同步问题)。
6、安装配置MySQL(主节点)
[root@master ~]# yum -y install mariadb-server*
[root@master ~]# vim /etc/my.cnf
[root@master ~]# systemctl restart mariadb.service
[root@master ~]# systemctl enable mariadb.service
[root@master ~]# mysql_secure_installation
[root@master ~]# mysql -uroot -p
Enter password:
MariaDB [(none)]> create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
MariaDB [(none)]> create database amon DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
MariaDB [(none)]> create database hue DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
MariaDB [(none)]> create database monitor DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
MariaDB [(none)]> create database oozie DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
MariaDB [(none)]> grant all on *.* to root@"%" Identified by "000000";
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit
7、其他安装与配置(全部节点都要做)
[root@master ~]# yum -y install psmisc MySQL-python at bc bind-libs bind-utils cups-client cups-libs cyrus-sasl-gssapi cyrus-sasl-plain ed fuse fuse-libs httpd httpd-tools keyutils-libs-devel krb5-devel libcom_err-devel libselinux-devel libsepol-devel libverto-devel mailcap noarch mailx mod_ssl openssl-devel pcre-devel postgresql-libs python-psycopg2 redhat-lsb-core redhat-lsb-submod-security x86_64 spax time zlib-devel
[root@master ~]# chmod +x /etc/rc.d/rc.local
[root@master ~]# echo "echo 0 > /proc/sys/vm/swappiness" >>/etc/rc.d/rc.local
[root@master ~]# echo "echo never > /sys/kernel/mm/transparent_hugepage/defrag" >>/etc/rc.d/rc.local
[root@master ~]# echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >>/etc/rc.d/rc.local
[root@master ~]# echo 0 > /proc/sys/vm/swappiness
[root@master ~]# echo never > /sys/kernel/mm/transparent_hugepage/defrag
[root@master ~]# echo never > /sys/kernel/mm/transparent_hugepage/enabled
[root@master ~]# yum -y install rpcbind
[root@master ~]# systemctl start rpcbind
[root@master ~]# echo "systemctl start rpcbind" >> /etc/rc.d/rc.local
二、开始安装CDH (主节点)
1、创建数据库
[root@master ~]# tar -zxvf cloudera-manager-centos7-cm5.13.0_x86_64.tar.gz -C /opt/
[root@master ~]# cp mysql-connector-java-8.0.8-dmr.jar /opt/cm-5.13.0/share/cmf/lib/ //JDBC
[root@master ~]# /opt/cm-5.13.0/share/cmf/schema/scm_prepare_database.sh mysql cm -hlocalhost -uroot -p000000 --scm-host localhost scm scm scm
//在这里后面的参数分别是:数据库类型 数据库名称 数据库主机名 数据库用户名 密码 --scm-host 主机名 scm scm scm
2、创建用户(每个节点都要)
[root@master ~]# useradd --system --home=/opt/cm-5.13.0/run/cloudera-scm-server --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
3、制作本地源
[root@master ~]# cp CDH-5.13.0-1.cdh5.13.0.p0.29-el7.parcel CDH-5.13.0-1.cdh5.13.0.p0.29-el7.parcel.sha manifest.json /opt/cloudera/parcel-repo/
[root@master ~]# cp mysql-connector-java-8.0.8-dmr.jar /usr/local/jdk1.8.0_131/lib/mysql-connector-java.jar //所有节点都要
4、Agent配置
修改/opt/cm-5.13.0/etc/cloudera-scm-agent/config.ini中的server_host
为主节点的主机名
[root@master ~]# vim /opt/cm-5.13.0/etc/cloudera-scm-agent/config.ini
server_host=master
同步Agent到其他所有节点
[root@master ~]# scp -r /opt/cm-5.13.0/ root@slave1:/opt/
[root@master ~]# scp -r /opt/cm-5.13.0/ root@slave2:/opt/
启动服务,在其他节点上起agent
[root@master ~]# /opt/cm-5.13.0/etc/init.d/cloudera-scm-server start
[root@master ~]# /opt/cm-5.13.0/etc/init.d/cloudera-scm-agent start
[root@slave1 ~]# /opt/cm-5.13.0/etc/init.d/cloudera-scm-agent start
[root@slave2 ~]# /opt/cm-5.13.0/etc/init.d/cloudera-scm-agent start
启动浏览器 http://192.168.210.6:7180 //用户名密码 admin:admin
//这里可能会出现hue链接不上的错误。是因为少装了一个包 yum install -y python-lxml 再测试就OK了
//根据自己的喜好来,后期可以再修改
开始安装!!!
然后首次失败了,因为我是tar.gz的JDK。他找不到我的JDK。。。
[root@master logs]# find / -type f -name "*.sh" | xargs grep "as ALT_NAME"
[root@master logs]# vim /opt/cm-5.13.0/lib64/cmf/service/client/deploy-cc.sh //直接再开头填上我的JAVA路径,三个节点都如此
JAVA_HOME=/usr/local/jdk1.8.0_131
export JAVA_HOME=/usr/local/jdk1.8.0_131
然后重新来,迎来了第二次失败。。原因是没用MySQL 的jdbc,行啊,复制一个过去
[root@master ~]# cp mysql-connector-java-8.0.8-dmr.jar /opt/cloudera/parcels/CDH-5.13.0-1.cdh5.13.0.p0.29/lib/hive/lib/
继续干,
嗯,完成。