IP 地址 | 主机名 | 硬件配置 | 操作系统 | 安装步骤 |
---|---|---|---|---|
10.168.168.1 | cm-server | 8C16G | Centos7 | 新建 |
10.168.168.2 | agent01 | 8C16G | Centos7 | 新建 |
10.168.168.3 | agent02 | 8C16G | Centos7 | 新建 |
10.168.168.4 | agent03 | 8C16G | Centos7 | 新建 |
10.168.168.5 | agent04 | 8C16G | Centos7 | 扩容 |
# 在跳板机执行如下ssh,或在各服务器上执行hostnamectl
ssh 10.168.168.1 "hostnamectl set-hostname cm-server"
ssh 10.168.168.2 "hostnamectl set-hostname agent01"
ssh 10.168.168.3 "hostnamectl set-hostname agent02"
ssh 10.168.168.4 "hostnamectl set-hostname agent03"
[root@cm-server ~]# vim /etc/hosts
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
# CDN cluster
10.168.168.1 cm-server
10.168.168.2 agent01
10.168.168.3 agent02
10.168.168.4 agent03
# 生成密钥,直接回车完成
[root@cm-server ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:cKlZT6epE6gSsONUfkMut0bJB7d/Xaz0G5i96IpPdOk root@cm-server
The key's randomart image is:
+---[RSA 2048]----+
| |
| . |
|. . o..+ . . |
| oo + +B.o + o |
|o..o O+oS +. + o |
|o. .=.+ .o. = B |
| .. .o o. o E + |
| .. .+ . +|
| ..ooo o |
+----[SHA256]-----+
# 分发密钥
[root@cm-server ~]# ssh-copy-id 10.168.168.1
输入密码
[root@cm-server ~]# ssh-copy-id 10.168.168.2
输入密码
[root@cm-server ~]# ssh-copy-id 10.168.168.3
输入密码
[root@cm-server ~]# ssh-copy-id 10.168.168.4
输入密码
# 或者通过
将cm-server节点的 ~/.ssh/id_rsa.pub 公钥文件内容 --> 追加到agent节点~/.ssh/authorized_keys文件中,实现免密。
# 检查内存
# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "free -g";done
#####10.168.168.1 节点结果如下:#####
total used free shared buff/cache available
Mem: 15 2 6 0 6 12
Swap: 9 0 9
#####10.168.168.2 节点结果如下:#####
total used free shared buff/cache available
Mem: 15 1 12 0 2 13
Swap: 9 0 9
#####10.168.168.3 节点结果如下:#####
total used free shared buff/cache available
Mem: 15 1 9 0 4 13
Swap: 9 0 9
#####10.168.168.4 节点结果如下:#####
total used free shared buff/cache available
Mem: 15 1 8 0 5 3
Swap: 9 0 9
# 检查CPU核数
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "lscpu | head -4 | tail -1";done
#####10.168.168.1 节点结果如下:#####
CPU(s): 8
#####10.168.168.2 节点结果如下:#####
CPU(s): 8
#####10.168.168.3 节点结果如下:#####
CPU(s): 8
#####10.168.168.4 节点结果如下:#####
CPU(s): 8
# 查看系统版本号
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "cat /etc/redhat-release";done
#####10.168.168.1 节点结果如下:#####
CentOS Linux release 7.3.1611 (Core)
#####10.168.168.2 节点结果如下:#####
CentOS Linux release 7.3.1611 (Core)
#####10.168.168.3 节点结果如下:#####
CentOS Linux release 7.3.1611 (Core)
#####10.168.168.4 节点结果如下:#####
CentOS Linux release 7.3.1611 (Core)
# 备份/etc/hosts
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "cp /etc/hosts /etc/hosts_cdhbak$(date +%Y%m%d)";done
# 分发/etc/hosts
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";scp /etc/hosts $ip:/etc/hosts;done
#####10.168.168.1 节点结果如下:#####
hosts 100% 263 661.3KB/s 00:00
#####10.168.168.2 节点结果如下:#####
hosts 100% 263 630.2KB/s 00:00
#####10.168.168.3 节点结果如下:#####
hosts 100% 263 547.2KB/s 00:00
#####10.168.168.4 节点结果如下:#####
hosts 100% 263 543.0KB/s 00:00
记住你安装包在 cm-server 节点存放的路径,等会分发安装包的时候要用。
[root@cm-server CDHsoftware]# pwd
/opt/CDHsoftware
[root@cm-server CDHsoftware]# ll
total 3412036
-rw-r--r-- 1 root root 14041 Aug 30 19:32 allkeys.asc
-rw-r--r-- 1 root root 2082186246 Aug 30 23:53 CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel
-rw-r--r-- 1 root root 40 Aug 30 19:32 CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha
-rw-r--r-- 1 root root 10483568 Aug 30 19:46 cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm
-rw-r--r-- 1 root root 1203832464 Aug 31 00:44 cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm
-rw-r--r-- 1 root root 11488 Aug 30 19:41 cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm
-rw-r--r-- 1 root root 194990602 Aug 30 20:45 jdk-8u211-linux-x64.tar.gz
drwxr-xr-x 2 root root 312 Aug 30 21:50 mysql
-rw-r--r-- 1 root root 2385601 Aug 30 19:47 mysql-connector-java-8.0.20.jar
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "systemctl disable firewalld";done
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "systemctl stop firewalld";done
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "setenforce 0";done
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config";done
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "swapoff -a";done
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "sed -i '/.*swap*/s/^/#/' /etc/fstab"|grep 'swap';done
#####10.168.168.1 节点结果如下:#####
#/dev/mapper/systemvg-swaplv swap swap defaults 0 0
#####10.168.168.2 节点结果如下:#####
#/dev/mapper/systemvg-swaplv swap swap defaults 0 0
#####10.168.168.3 节点结果如下:#####
#/dev/mapper/systemvg-swaplv swap swap defaults 0 0
#####10.168.168.4 节点结果如下:#####
#/dev/mapper/systemvg-swaplv swap swap defaults 0 0
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "echo never > /sys/kernel/mm/transparent_hugepage/defrag";done
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "echo never > /sys/kernel/mm/transparent_hugepage/enabled";done
# 在cm-server节点将同一命令添加到 /etc/rc.local 等初始化脚本中
grep -q 'never' /etc/rc.d/rc.local
if [ "$?" == "1" ] ; then
cat >> /etc/rc.d/rc.local << EOF
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
EOF
fi
# 分发cm-server节点的 /etc/rc.d/rc.local到各个节点
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";scp /etc/rc.d/rc.local $ip:/etc/rc.d/rc.local;done
Centos7 默认已经安装了 Python 2.7.5 版本
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "python -V";done
#####10.168.168.1 节点结果如下:#####
Python 2.7.5
#####10.168.168.2 节点结果如下:#####
Python 2.7.5
#####10.168.168.3 节点结果如下:#####
Python 2.7.5
#####10.168.168.4 节点结果如下:#####
Python 2.7.5
#如果系统没有安装,或者没有安装则使用以下命令安装
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "yum install -y python275";done
# 新建/usr/java/目录
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "mkdir -p /usr/java/";done
# 分发jdk-8u211-linux-x64.tar.gz安装包到/usr/java/目录下
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";scp /opt/CDHsoftware/jdk-8u211-linux-x64.tar.gz $ip:/usr/java/;done
#####10.168.168.1 节点结果如下:#####
jdk-8u211-linux-x64.tar.gz 100% 186MB 92.9MB/s 00:02
#####10.168.168.2 节点结果如下:#####
jdk-8u211-linux-x64.tar.gz 100% 186MB 93.0MB/s 00:02
#####10.168.168.3 节点结果如下:#####
jdk-8u211-linux-x64.tar.gz 100% 186MB 93.0MB/s 00:02
#####10.168.168.4 节点结果如下:#####
jdk-8u211-linux-x64.tar.gz 100% 186MB 99.9MB/s 00:01
# 在/usr/java/目录下解压jdk-8u211-linux-x64.tar.gz安装
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "cd /usr/java/;tar -xf jdk-8u211-linux-x64.tar.gz";done
# 删除jdk安装包
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "cd /usr/java/;rm -f jdk-8u211-linux-x64.tar.gz";done
# 生成软链。此处我就踩了一个坑,导致agent安装完成后起不来。cdh启用时, 默认会从/usr/java/default路径读取java环境, 所以此处需要做个软链
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "cd /usr/java/;ln -nsf jdk1.8.0_211 /usr/java/default";done
# 备份/etc/profile
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "cp /etc/profile /etc/profile_cdhbak$(date +%Y%m%d)";done
# 增加环境变量参数
[root@cm-server ~]# vim /etc/profile
# JAVA_HOME
export JAVA_HOME=/usr/java/default
export CLASSPATH=./:$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
# 分发/etc/profile文件到各个节点上
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";scp /etc/profile $ip:/etc/profile;done
# 引用变量参数,使profile文件生效,并验证java版本
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "source /etc/profile;java -version";done
#####10.168.168.1 节点结果如下:#####
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
#####10.168.168.2 节点结果如下:#####
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
#####10.168.168.3 节点结果如下:#####
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
#####10.168.168.4 节点结果如下:#####
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
如果自己有 mysql 库,可以跳过这一步骤。
# 进入mysql安装包目录
[root@cm-server ~]# cd /opt/CDHsoftware/mysql
# 【注意】 安装mysql过程中可能会出现报错失败,大多都是因lib冲突,或者小版本依赖等问题。为了保证安装顺利进行,此处我选择了先解决mysql依赖的问题。
# 以下是常用的解决办法。
# 库冲突:清理mysql-libs库
[root@cm-server mysql]# yum remove mysql-libs
输入y继续
# 缺少依赖:安装libaio autoconf
[root@cm-server mysql]# yum install -y libaio autoconf
# 提示mariadb相关的报错:删除mariadb的lib库
[root@cm-server mysql]# rpm -qa | grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
[root@cm-server mysql]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
# 安装mysql依赖
[root@cm-server mysql]# rpm -ivh 01_mysql-community-common-5.7.29-1.el7.x86_64.rpm
[root@cm-server mysql]# rpm -ivh 02_mysql-community-libs-5.7.29-1.el7.x86_64.rpm
[root@cm-server mysql]# rpm -ivh 03_mysql-community-libs-compat-5.7.29-1.el7.x86_64.rpm
# 安装mysql-client
[root@cm-server mysql]# rpm -ivh 04_mysql-community-client-5.7.29-1.el7.x86_64.rpm
# 安装mysql-server
[root@cm-server mysql]# rpm -ivh 05_mysql-community-server-5.7.29-1.el7.x86_64.rpm
# 启动mysql并设置开机自启
[root@cm-server mysql]# systemctl start mysqld && systemctl enable mysqld
# 查看新装mysql密码
[root@cm-server mysql]# cat /var/log/mysqld.log | grep password
2023-09-08T09:17:17.083363Z 1 [Note] A temporary password is generated for root@localhost: SqY+aPJoZ5Qh
# 通过日志获取到初始密码 SqY+aPJoZ5Qh
# 用刚刚查到的密码进入mysql(初始密码中可能会有各种符号,命令行登录如果报错,给密码加单引号)
[root@cm-server mysql]# mysql -uroot -p'SqY+aPJoZ5Qh'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.29
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
# 设置复杂密码(由于mysql密码策略,此密码必须足够复杂)
mysql> set password=password("Cola@2023");
Query OK, 0 rows affected, 1 warning (0.00 sec)
# 更改mysql密码策略
mysql> set global validate_password_length=4;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)
# 设置简单好记的密码
mysql> set password=password("123456");
Query OK, 0 rows affected, 1 warning (0.00 sec)
# 切到msyql系统库
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
# 查询user表
mysql> select user, host from user;
+---------------+-----------+
| user | host |
+---------------+-----------+
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+-----------+
3 rows in set (0.00 sec)
# 修改user表,把Host表内容修改为% , 扩大数据库登录范围
mysql> update user set host="%" where user="root";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
# 刷新更改配置
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
# 退出MySQL
mysql> exit
Bye
# 查看MySQL版本
[root@cm-server mysql]# mysql -V
mysql Ver 14.14 Distrib 5.7.29, for Linux (x86_64) using EditLine wrapper
# 尝试使用新密码123456,重新登陆MySQL
[root@cm-server mysql]# mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.29 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
# 导入cdh_db.sql文件;一些服务的库、用户名和密码,可以先自行修改密码再执行
mysql> source cdh_db.sql
Query OK, 1 row affected (0.00 sec)
mysql> quit;
Bye
# 新建/usr/share/java/目录
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "mkdir -p /usr/share/java/";done
# 分发jdbc启动包到各个节点
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";scp /opt/CDHsoftware/mysql-connector-java-8.0.20.jar $ip:/usr/share/java/mysql-connector-java.jar;done
#####10.168.168.1 节点结果如下:#####
mysql-connector-java-8.0.20.jar 100% 2330KB 87.5MB/s 00:00
#####10.168.168.2 节点结果如下:#####
mysql-connector-java-8.0.20.jar 100% 2330KB 48.4MB/s 00:00
#####10.168.168.3 节点结果如下:#####
mysql-connector-java-8.0.20.jar 100% 2330KB 30.7MB/s 00:00
#####10.168.168.4 节点结果如下:#####
mysql-connector-java-8.0.20.jar 100% 2330KB 30.7MB/s 00:00
大部分公司都会在安装系统时统一做好时间同步服务,所以不需要的可以跳过这一步骤。
# 安装NTP
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "myum install ntp";done
# 启动
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "chkconfig ntpd on";done
# 从NTP服务器同步时间。如果没有就将 NTP服务器IP 配置为 cm-server节点的IP。
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "ntpdate -u NTP服务器IP";done
#####10.168.168.1 节点结果如下:#####
8 Sep 17:45:23 ntpdate[10673]: adjust time server NTP服务器IP offset 0.015031 sec
#####10.168.168.2 节点结果如下:#####
8 Sep 17:45:30 ntpdate[15808]: adjust time server NTP服务器IP offset -0.004186 sec
#####10.168.168.3 节点结果如下:#####
8 Sep 17:45:36 ntpdate[9624]: adjust time server NTP服务器IP offset 0.014731 sec
#####10.168.168.4 节点结果如下:#####
8 Sep 17:45:42 ntpdate[23049]: adjust time server NTP服务器IP offset 0.017200 sec
# 每个节点分别添加crontab任务
*/30 * * * * /usr/sbin/ntpdate -u NTP服务器IP >> /dev/null 2>&1
# 进入安装包所在目录
[root@cm-server CDHsoftware]# cd /opt/CDHsoftware
# 安装cm-server服务
[root@cm-server CDHsoftware]# yum install -y cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm
[root@cm-server CDHsoftware]# yum install -y cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm
# server上分发agent安装包
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";scp /opt/CDHsoftware/cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm $ip:~/;done
#####10.168.168.1 节点结果如下:#####
cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm 100% 10MB 120.5MB/s 00:00
#####10.168.168.2 节点结果如下:#####
cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm 100% 10MB 98.6MB/s 00:00
#####10.168.168.3 节点结果如下:#####
cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm 100% 10MB 99.0MB/s 00:00
#####10.168.168.4 节点结果如下:#####
cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm 100% 10MB 71.8MB/s 00:00
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";scp /opt/CDHsoftware/cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm $ip:~/;done
#####10.168.168.1 节点结果如下:#####
cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm 100% 1148MB 114.8MB/s 00:10
#####10.168.168.2 节点结果如下:#####
cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm 100% 1148MB 82.0MB/s 00:14
#####10.168.168.3 节点结果如下:#####
cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm 100% 1148MB 76.5MB/s 00:15
#####10.168.168.4 节点结果如下:#####
cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm 100% 1148MB 94.2MB/s 00:12
# 所有agent节点都需要安装agent服务。grep -E记得去掉cm-server。
#注意:(如果你的集群小,cm-server节点其实也可以装agent服务。我这里主要考虑将cm-server独立部署,虽然浪费了资源,但方便以后出现多集群维护时出现的性能问题。)
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "yum install -y cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm";done
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "yum install -y cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm";done
# 修改所有agent节点的配置文件,将server_host的配置改为server的主机名 [ 主机名是自己环境的server的host主机名 ]
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "sed -i 's/server_host=localhost/server_host=cm-server/g' /etc/cloudera-scm-agent/config.ini";done
# 删除安装包
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "rm -f cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm";done
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "rm -f cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm";done
[root@cm-server CDHsoftware]# ls -l /opt/cloudera/cm/schema/scm_prepare_database.sh
-rwxr-xr-x 1 root root 12450 Sep 25 2019 /opt/cloudera/cm/schema/scm_prepare_database.sh
# 注意替换ip地址,如果创建时,cdh_db.sql的密码改过这里需要对应改密码
[root@cm-server CDHsoftware]# /opt/cloudera/cm/schema/scm_prepare_database.sh -h 10.168.168.1 mysql scm scm 123456
JAVA_HOME=/usr/java/default
Verifying that we can write to /etc/cloudera-scm-server
Creating SCM configuration file in /etc/cloudera-scm-server
Executing: /usr/java/default/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/usr/share/java/postgresql-connector-java.jar:/opt/cloudera/cm/schema/../lib/* com.cloudera.enterprise.dbutil.DbCommandExecutor /etc/cloudera-scm-server/db.properties com.cloudera.cmf.db.
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
[ main] DbCommandExecutor INFO Successfully connected to database.
All done, your SCM database is configured correctly! # 到这一步,输出相同,就代表初始化成功了
文件放置在/opt/cloudera/parcel-repo/目录下以后,在后续的界面安装各个服务时,在目录中找到版本文件,可以自动匹配到安装文件,无需连外网下载。
[root@cm-server CDHsoftware]# cp /opt/CDHsoftware/CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel /opt/cloudera/parcel-repo/
[root@cm-server CDHsoftware]# cp /opt/CDHsoftware/CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha /opt/cloudera/parcel-repo/
# 启动cm-server节点的cm-server服务
[root@cm-server CDHsoftware]# systemctl start cloudera-scm-server
[root@cm-server CDHsoftware]# systemctl enable cloudera-scm-server
# 启动所有节点agent节点的agent服务
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "systemctl start cloudera-scm-agent";done
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "systemctl enable cloudera-scm-agent";done
http://cm-serverIP:7180/cmf/login (Username:admin Password:admin)
#注意:7180 在高版本 linux 系统和阿里腾讯华为等公有云可能会出现端口为开放的情况,需要在系统上把对应的端口策略打开,才可以访问。
cdh02
cdh03
cdh04
cdh05
cdh06
一般安装正确,在当前管理的主机中都会自动带出 agent 安装好的节点。如果你的页面没有带出来,最好检查一下 agent 安装或者配置出现了错误。
cdh08
Parcel 我用的是默认值,此处什么都没有改动。如果你还有印象,应该发现了前面步骤中新建过/opt/cloudera/parcel-repo/目录,并放置了两个 parcel 安装包。
如果你有需要,可以在自己的服务器上,配置一下本地的远程 Parcel 存储库 URL,此处不做介绍。
Clouder Manager Server 会将 parcel 解压,分发,安装到每一台选择 Clouder Manager Agent 的服务器。节点越多,速度越慢,需要耐心等待进度完成后才可点击下一步。
cdh11
cdh12
cdh13
建议所有人都手动分配一下角色分布,CDH 自动分配的角色在实际测试中会有一些性能问题。特别是 Hue/HiveServer2/Flume 的负载特别高,zk>hdfs 主节点>yarn 的主节点重要程度比较高,尽量不要和 Hue/HiveServer2/Flume 部署在同一台节点上。
Cloudera Management Service:建议独立放在 agent01 上,有条件的环境,这台机器不要放置其他角色的服务;
HiveServer2(或 Hue/Flume ):这些角色非常吃 CPU 和内存,建议不要和 CM 服务放在同一天机器上;例如红框的 HiveServer2 服务是放在 agent03 上。
NN、SNN、RM、JHS:这些都是主节点相关的服务,为了稳定性,建议角色独立分布或者交叉分布,不要放在同一个节点上;例如绿框的 NN\SNN\RN\JHS 服务是交叉放在 agent02 和 agent03 上。
DN、NM:建议所有节点都部署,能最大化分布式架构的有点;例如黄框中的 DN 和 NM,是所有节点都部署。
zookeeper:建议最少防止三台,如果是生产环境,建议划分到 5 台的规模;例如黄框中的 zookeeper 的 server 服务,因为本次我们只有三个节点,最小节点数和所有 agent 节点数量重合。
cdh15
如果测试不通过,发现需要的数据库、用户名、密码不存在,可以参照执行的 sql 文件格式,新增库和用户名等。
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;
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY '123456';
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY '123456';
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY '123456';
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY '123456';
GRANT ALL ON metastore.* TO 'metastore'@'%' IDENTIFIED BY '123456';
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY '123456';
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY '123456';
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY '123456';
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY '123456';
GRANT ALL ON hive.* TO 'hive'@'%' IDENTIFIED BY '123456';
使用默认分配即可。但也要检查一下,看一下自动分配的数据目录有没有问题,CDH 会自动识别检测你的挂载目录。我的数据盘挂载目录是/data01,希望数据目录全部挂载在此目录下。如果你有多个数据盘,一般会自动出现多个数据目录,也可以自己手动添加。
节点越多,安装时间越长,喝口水等一会,别急。
cdh18
没想到搭建完成全是感叹号,满屏告警。我的因为是测试环境,磁盘空间都很小。所以大家就当看不见感叹号,我看了我的告警,都与配置安装无关。我的文档大家放心,都是自己测试验证过的。
在这里可以点击相关的告警,打开后可以根据告警优化。如果遇到需要修改配置的,需要重启相关服务或者整个集群的服务。
CDH 支持按照组件维度进行检查,另外也可以查看主机和集群的角色分布情况。如果觉得集群分布不合理,可以合理利用主机和角色这两个功能辅助你分析问题。
可以在现有集群上安装 kafka 等服务,可以按需添加,cdh 即便是新手操作起来也很简单。
# 在跳板机执行如下ssh,或在各服务器上执行hostnamectl
ssh 10.168.168.5 "hostnamectl set-hostname agent04"
[root@cm-server ~]# vim /etc/hosts
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
# CDN cluster
10.168.168.1 cm-server
10.168.168.2 agent01
10.168.168.3 agent02
10.168.168.4 agent03
10.168.168.5 agent04
# 分发密钥
[root@cm-server ~]# ssh-copy-id 10.168.168.5
输入密码
# 或者通过
将cm-server节点的 ~/.ssh/id_rsa.pub 公钥文件内容 --> 追加到agent节点~/.ssh/authorized_keys文件中,实现免密。
# 检查内存
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "free -g";done
#####10.168.168.5 节点结果如下:#####
total used free shared buff/cache available
Mem: 15 1 12 0 1 6
Swap: 9 0 9
# 检查CPU核数
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "lscpu | head -4 | tail -1";done
#####10.168.168.5 节点结果如下:#####
CPU(s): 8
# 查看系统版本号
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "cat /etc/redhat-release";done
#####10.168.168.5 节点结果如下:#####
CentOS Linux release 7.3.1611 (Core)
这次分发是需要分发到整个集群所有节点上,不仅仅是扩容节点。
# 备份所有节点/etc/hosts
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "cp /etc/hosts /etc/hosts_cdhbak$(date +%Y%m%d)";done
# 分发/etc/hosts到所有节点
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'cm-server|agent'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";scp /etc/hosts $ip:/etc/hosts;done
#####10.168.168.1 节点结果如下:#####
hosts 100% 285 769.2KB/s 00:00
#####10.168.168.2 节点结果如下:#####
hosts 100% 285 353.4KB/s 00:00
#####10.168.168.3 节点结果如下:#####
hosts 100% 285 286.2KB/s 00:00
#####10.168.168.4 节点结果如下:#####
hosts 100% 285 407.7KB/s 00:00
#####10.168.168.5 节点结果如下:#####
hosts 100% 285 299.0KB/s 00:00
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "systemctl disable firewalld";done
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "systemctl stop firewalld";done
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "setenforce 0";done
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config";done
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "swapoff -a";done
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "sed -i '/.*swap*/s/^/#/' /etc/fstab"|grep 'swap';done
#####10.168.168.5 节点结果如下:#####
#/dev/mapper/systemvg-swaplv swap swap defaults 0 0
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "echo never > /sys/kernel/mm/transparent_hugepage/defrag";done
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "echo never > /sys/kernel/mm/transparent_hugepage/enabled";done
# 分发cm-server节点的 /etc/rc.d/rc.local到各个节点
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";scp /etc/rc.d/rc.local $ip:/etc/rc.d/rc.local;done
Centos7 默认已经安装了 Python 2.7.5 版本
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "python -V";done
#####10.168.168.5 节点结果如下:#####
Python 2.7.5
#如果系统没有安装,或者没有安装则使用以下命令安装
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "yum install -y python275";done
# 新建/usr/java/目录
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "mkdir -p /usr/java/";done
# 分发jdk-8u211-linux-x64.tar.gz安装包到/usr/java/目录下
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";scp /opt/CDHsoftware/jdk-8u211-linux-x64.tar.gz $ip:/usr/java/;done#####10.168.168.5 节点结果如下:#####
jdk-8u211-linux-x64.tar.gz 100% 186MB 95.8MB/s 00:01
# 在/usr/java/目录下解压jdk-8u211-linux-x64.tar.gz安装
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "cd /usr/java/;tar -xf jdk-8u211-linux-x64.tar.gz";done
# 删除jdk安装包
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "cd /usr/java/;rm -f jdk-8u211-linux-x64.tar.gz";done
# 生成软链。此处我就踩了一个坑,导致agent安装完成后起不来。cdh启用时, 默认会从/usr/java/default路径读取java环境, 所以此处需要做个软链
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "cd /usr/java/;ln -nsf jdk1.8.0_211 /usr/java/default";done
# 备份/etc/profile
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "cp /etc/profile /etc/profile_cdhbak$(date +%Y%m%d)";done
# 分发cm-server节点的/etc/profile文件到各个节点上
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";scp /etc/profile $ip:/etc/profile;done
# 引用变量参数,使profile文件生效,并验证java版本
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "source /etc/profile;java -version";done
#####10.168.168.5 节点结果如下:#####
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
# 新建/usr/share/java/目录
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "mkdir -p /usr/share/java/";done
# 分发jdbc启动包到各个节点
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";scp /opt/CDHsoftware/mysql-connector-java-8.0.20.jar $ip:/usr/share/java/mysql-connector-java.jar;done
#####10.168.168.5 节点结果如下:#####
mysql-connector-java-8.0.20.jar 100% 2330KB 19.2MB/s 00:00
大部分公司都会在安装系统时统一做好时间同步服务,所以不需要的可以跳过这一步骤。
# 安装NTP
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "myum install ntp";done
# 启动
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "chkconfig ntpd on";done
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "ntpdate -u 10.47.222.240";done
#####10.168.168.5 节点结果如下:#####
12 Sep 11:03:08 ntpdate[12770]: adjust time server 10.47.222.240 offset -0.006283 sec
# 每个节点分别添加crontab任务
*/30 * * * * /usr/sbin/ntpdate -u NTP服务器IP >> /dev/null 2>&1
# server上分发agent安装包
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";scp /opt/CDHsoftware/cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm $ip:~/;done
#####10.168.168.5 节点结果如下:#####
cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm 100% 10MB 39.9MB/s 00:00
[root@cm-server ~]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";scp /opt/CDHsoftware/cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm $ip:~/;done
#####10.168.168.5 节点结果如下:#####
cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm 100% 1148MB 95.7MB/s 00:12
# 扩容节点都需要安装agent服务,不然cdh页面安装时可能监测不到节点。
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "yum install -y cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm";done
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "yum install -y cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm";done
# 修改所有agent节点的配置文件,将server_host的配置改为server的主机名 [ 主机名是自己环境的server的host主机名 ]
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "sed -i 's/server_host=localhost/server_host=cm-server/g' /etc/cloudera-scm-agent/config.ini";done
# 删除安装包
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "rm -f cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm";done
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "rm -f cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm";done
# 启动所有节点agent节点的agent服务
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "systemctl start cloudera-scm-agent";done
[root@cm-server CDHsoftware]# for ip in `cat /etc/hosts|grep -E 'agent04'|awk '{print $1}'`;do echo "#####${ip} 节点结果如下:#####";ssh $ip "systemctl enable cloudera-scm-agent";done
cdh23
cdh24
如果之前在 agent04 上安装 agent 没有问题,这里都会自动带出来当前管理的主机。如果没有去检查一下 linux 相关的配置是否有问题,在检查一下 agent 服务是否正常启动。
这里没什么可介绍的了,如果你是自己安装前面步骤搭建的,到这里就会发现很熟悉,按照引导继续走就可以了。
选择主机模板,如果长期使用的集群,一般都会有模板的,主要是节点的角色,创建好直接有哪些服务的 node 等等;没有则可以直接选择无,代表加入集群后,手动添加服务实例。
cdh28
例如在 HDFS 上添加角色实例
cdh30
cdh31
cdh32
由此可以看到 DN 角色已经存在 HDFS 组件中,但是状态未启动,需要自己启动一下。至此扩容就结束了。