修改网络和主机名 cdh6-master
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 [root@cdh6-master ~]# hostnamectl set-hostname cdh6-master [root@cdh6-master ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=bdf6fb11-50f4-403a-8ba6-b9dca61a591e DEVICE=ens33 ONBOOT=yes IPADDR=192.168.200.101 NETMASK=255.255.255.0 GATEWAY=192.168.200.2 DNS1=8.8.8.8
cdh6-slave1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 cdh6-slave1[root@cdh6-slave1 ~]# hostnamectl set-hostname cdh6-slave1 [root@cdh6-slave1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=e2b4e53e-5a4d-4b20-b6ff-39a67539214a DEVICE=ens33 ONBOOT=yes IPADDR=192.168.200.102 NETMASK=255.255.255.0 GATEWAY=192.168.200.2 DNS1=8.8.8.8
cdh6-slave2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 [root@cdh6-slave2 ~]# hostnamectl set-hostname cdh6-slave2 [root@cdh6-slave2 ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=a15136a1-c83b-4750-9ff3-2ca779e39818 DEVICE=ens33 ONBOOT=yes IPADDR=192.168.200.103 NETMASK=255.255.255.0 GATEWAY=192.168.200.2 DNS1=8.8.8.8
关闭防火墙和SELinux host
1 2 3 4 5 vi /etc/hosts: 192.168.200.101 cdh6-master 192.168.200.102 cdh6-slave1 192.168.200.103 cdh6-slave2
防火墙
1 2 3 4 5 6 7 8 # systemctl stop firewalld # systemctl disable firewalld # setenforce 0 # 修改 /etc/selinux/config 下的 SELINUX=disabled
SSH免密登陆 在cdh6-master节点(只需要主节点能免密登陆其它节点以及自己就可以了):
1 2 3 4 5 6 7 # ssh-keygen # ssh-copy-id cdh6-master ssh-copy-id cdh6-slave1 ssh-copy-id cdh6-slave2
注意事项:如果出现 ssh-copy-id: command not found 需要执行该命令(yum -y install openssh-clients)
集群时间同步 所有节点 1 2 3 4 # rpm -qa |grep ntpd # yum install -y ntp
cdh6-master 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 vi /etc/ntp.conf # restrict 192.168.200.2 mask 255.255.255.0 nomodify notrap # # server 0.centos.pool.ntp.org iburst # server 1.centos.pool.ntp.org iburst # server 2.centos.pool.ntp.org iburst # server 3.centos.pool.ntp.org iburst # server 127.127.1.0 fudge 127.127.1.0 stratum 10 vi /etc/sysconfig/ntpd # SYNC_HWCLOCK=yes # ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
cdh6-slave1和cdh6-slave2 1 2 3 # * * * * * /usr/sbin/ntpdate cdh6-master
启动所有节点的ntp 1 2 3 service ntpd start chkconfig ntpd on
安装repo、GPG key、jdk 所有节点
1 2 3 4 5 # wget https://archive.cloudera.com/cm6/6.3.0/redhat7/yum/cloudera-manager.repo -P /etc/yum.repos.d/ # rpm --import https://archive.cloudera.com/cm6/6.3.0/redhat7/yum/RPM-GPG-KEY-cloudera
jdk
1 2 3 4 5 6 7 8 9 # yum install -y oracle-j2sdk1.8 # vi /etc/profile # export JAVA_HOME=/usr/java/jdk1.8.0_141-cloudera export PATH=$PATH:$JAVA_HOME/bin # source /etc/profile
docker安装mysql 略
安装MySQL JDBC Driver 所有节点
1 2 3 4 5 6 7 8 9 10 wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz tar -zxvf mysql-connector-java-5.1.46.tar.gz mkdir -p /usr/share/java/ cd mysql-connector-java-5.1.46 cp mysql-connector-java-5.1.46-bin.jar /usr/share/java/mysql-connector-java.jar
注意:一定要将mysql-connector-java-5.1.46-bin.jar改名为mysql-connector-java.jar,不然初始化cm的时候无法识别。
创建数据库 在安装MySQL的节点,需要建的库有scm、amon、rman、hue、metastore、sentry、nav、navms、oozie
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
开放远程权限
1 2 3 4 5 6 7 8 mysql> use mysql; mysql> grant all privileges on *.* to 'root' @'%' identified by '123456' with grant option; mysql> grant all privileges on *.* to 'scm' @'master.cdh6' identified by '123456' with grant option; mysql> flush privileges;
初始化数据库 我这里MySQL安装在cdh6-slave1节点,cm-server安装在cdh6-master节点
1 /opt/cloudera/cm/schema/scm_prepare_database.sh mysql -h cdh6-slave1 --scm-host cdh6-master scm scm
注意事项,如果MySQL和cm-server在一台服务器上:
1 /opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm
离线安装cdh 下载安装包 CM 1 2 3 4 cloudera-manager-server-db-2-6.3.1-1466458.el7.x86_64.rpm cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm
CDH 1 2 3 CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha1 CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha256
注意: CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha256重命名为CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha,这点必须注意否则,系统会重新下载。 然后,CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel.sha中的秘钥修改为对应版本的秘钥。
解压CM安装包 环境依赖安装:
1 2 3 yum install -y perl yum install -y bind-utils psmisc libxslt cyrus-sasl-plain cyrus-sasl-gssapi fuse portmap fuse-libs httpd mod_ssl openssl-devel python-psycopg2 MySQL-python /lib/lsb/init-functions libpq.so.5
所有节点:
1 2 3 rpm -ivh cloudera-manager-daemons-6.3.0-1281944.el7.x86_64.rpm rpm -ivh cloudera-manager-agent-6.3.0-1281944.el7.x86_64.rpm
仅仅在master节点:
1 rpm -ivh cloudera-manager-server-6.3.0-1281944.el7.x86_64.rpm
修改所有节点的CM主机指向
1 2 3 vi /etc/cloudera-scm-agent/config.ini # 将server_host修改为CM-Server所在的主机名 server_host=cdh6-master
启动cdh6-master节点的cloudera-scm-server 1 2 3 systemctl start cloudera-scm-server systemctl enable cloudera-scm-server
等待server启动完毕之后,再启动所有节点的cloudera-scm-agent
1 2 systemctl start cloudera-scm-agent systemctl enable cloudera-scm-agent
web安装大数据组件 略
可能会遇到的问题 虚拟内存设置 Cloudera 建议将 /proc/sys/vm/swappiness 设置为 0。当前设置为 60。使用 sysctl 命令在运行时更改该设置并编辑 /etc/sysctl.conf 以在重启后保存该设置。您可以继续进行安装,但可能会遇到问题,Cloudera Manager 报告您的主机由于交换运行状况不佳。以下主机受到影响
临时解决
1 echo 0 > /proc/sys/vm/swappiness
永久解决
1 2 3 sysctl -w vm.swappiness=0 echo vm.swappiness = 0 >> /etc/sysctl.conf
大内存设置 大内存页禁用
1 2 3 echo never>/sys/kernel/mm/transparent_hugepage/defrag echo never>/sys/kernel/mm/transparent_hugepage/enabled
升级软件依赖版本 Starting with CDH 6, PostgreSQL-backed Hue requires the Psycopg2 version to be at least 2.5.4, see the documentation for more information. This warning can be ignored if hosts will not run CDH 6, or will not run Hue with PostgreSQL. The following hosts have an incompatible Psycopg2 version of ‘2.5.1’
解决方法:可以忽略
1 2 3 yum install python-pip pip install --upgrade psycopg2
安装Parcel提示主机运行状况不良
删除agent目录下面的cm_guid文件,并重启失败节点的agent服务恢复。
1 2 3 4 5 6 7 find / -name cm_guid /var/lib/cloudera-scm-agent/cm_guid 删除它/var/lib/cloudera-scm-agent/cm_guid ###重启agent systemctl cloudera-scm-agent restart