?简单来说,Cloudera Manager是一个拥有集群自动化安装、中心化管理、集群监控、报警功能的一个工具(软件),使得安装集群从几天的时间缩短在几个小时内,运维人员从数十人降低到几人以内,极大的提高集群管理的效率。
CM6.3.1+CDH6.3.2 组件版本如下:
组件 | 版本 | 发行版 | CDH |
---|---|---|---|
版本Supervisord | 3 | 不可用 | 不适用 |
Cloudera Manager Agent | 6.3.1 | 1466458.el7 | 不适用 |
Cloudera Manager Management Daemon | 6.3.1 | 1466458.el7 | 不适用 |
Flume NG | 1.9.0+cdh6.3.2 | 1605554 | CDH 6.3.2 |
Hadoop | 3.0.0+cdh | 6.3.2 | 1605554 |
HDFS | 3.0.0+cdh | 6.3.2 | 1605554 |
HttpFS | 3.0.0+cdh | 6.3.2 | 1605554 |
hadoop-kms | 3.0.0+cdh6.3.2 | 1605554 | CDH 6.3.2 |
MapReduce 2 | 3.0.0+cdh6.3.2 | 1605554 | CDH 6.3.2 |
YARN | 3.0.0+cdh6.3.2 | 1605554 | CDH 6.3.2 |
HBase | 2.1.0+cdh6.3.2 | 1605554 | CDH 6.3.2 |
Lily HBase Indexer | 1.5+cdh6.3.2 | 1605554 | CDH 6.3.2 |
Hive | 2.1.1+cdh6.3.2 | 1605554 | CDH 6.3.2 |
HCatalog | 2.1.1+cdh6.3.2 | 1605554 | CDH 6.3.2 |
Hue | 4.2.0+cdh6.3.21605554 | CDH 6.3.2 | |
Impala | 3.2.0+cdh6.3.2 | 1605554 | CDH 6.3.2 |
Java 8 | java version 1.8.0_131 | 不可用 | 不适用 |
Kafka | 2.2.1+cdh6.3.2 | 1605554 | CDH 6.3.2 |
Kite(仅限 CDH 5 ) | 1.0.0+cdh6.3.2 | 1605554 | CDH 6.3.2 |
kudu | 1.10.0+cdh6.3.2 | 1605554 | CDH 6.3.2 |
Oozie | 5.1.0+cdh6.3.2 | 1605554 | CDH 6.3.2 |
Parquet | 1.9.0+cdh6.3.2 | 1605554 | CDH 6.3.2 |
Pig | 0.17.0+cdh6.3.2 | 1605554 | CDH 6.3.2 |
sentry | 2.1.0+cdh6.3.2 | 1605554 | CDH 6.3.2 |
Solr | 7.4.0+cdh6.3.2 | 1605554 | CDH 6.3.2 |
spark | 2.4.0+cdh6.3.2 | 1605554 | CDH 6.3.2 |
Sqoop | 1.4.7+cdh6.3.2 | 1605554 | CDH 6.3.2 |
ZooKeeper | 3.4.5+cdh6.3.2 | 1605554 | CDH 6.3.2 |
其他
节点名称 | IP | CentoS | CPU | 内存 | 磁盘 | 组件 |
---|---|---|---|---|---|---|
h1 | 192.168.6.61 | 7.9 | 2 | 10G | /dev/sda3 250G | mysql5.7,http,ntp,jdk-8u131 |
h2 | 192.168.6.62 | 7.9 | 2 | 8G | /dev/sda3 250G | ntp,jdk-8u131 |
h3 | 192.168.6.63 | 7.9 | 2 | 8G | /dev/sda3 250G | ntp,jdk-8u131 |
h4 | 192.168.6.64 | 7.9 | 2 | 8G | /dev/sda3 250G | ntp,jdk-8u131 |
序号 | 软件名称 | 版本信息 | 备注 |
---|---|---|---|
1 | Centos操作系统发行版 | CentOS Linux release 7.9.2009 x86_64 | CDH要求7.2或更高 |
2 | MySQL数据库 | 5.7.43 x86_64 | CDH6推荐5.7或更高,务必使用utf8编码而非utf8mb4编码 |
3 | JDK | 1.8.0_181 x86_64 | CDH6将不再支持JDK1.7推荐1.8u181 |
4 | python | 2.7.5 | |
5 | CDH | 6.3.2 | |
6 | CM | 6.3.1 |
CM包:
allkeys.asc
cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm
cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm
cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm
cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm
cloudera-manager-server-db-2-6.3.1-1466458.el7.x86_64.rpm
enterprise-debuginfo-6.3.1-1466458.el7.x86_64.rpm
oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
CDH包:
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
manifest.json
安装方式二
#登录后复制
cd /tmp
wget -c https://github.com/ghl1024/ansible-offline-install/releases/download/V1/ansible-offline-install.tar.gz
tar xf ansible-offline-install.tar.gz
cd ansible
sh install.sh
#设置参数为不检查key
sed -i "s/#host_key_checking = False/host_key_checking = False/g" /etc/ansible/ansible.cfg
#如果有提示安装则安装
yum install -y sshpass
cat >/etc/ansible/hosts <<EOF
[all:vars]
ansible_ssh_user='root'
ansible_ssh_port=7009
ansible_ssh_pass='Abcd@123456'
[k8s]
192.168.6.61
192.168.6.62
192.168.6.63
192.168.6.64
EOF
ansible all -m raw -a " df -h"
?Centos7静态网络配置文件是/etc/sysconfig/network-scripts/ifcfg-,我本机网络接口名称为p2p1,修改所有节点网络配
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens160
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
NAME=ens160
DEVICE=ens160
ONBOOT=yes
IPADDR=192.168.6.61 #改为对应节点IP
GATEWAY=192.168.6.1
NETMASK=255.255.255.0
DNS1=61.139.2.69
DNS2=8.8.8.8
#重启网络可立即生效
systemctl restart network
#修改所有节点的hostname,重启节点立即生效
ansible 192.168.6.61 -m raw -a "hostnamectl set-hostname h1"
ansible 192.168.6.62 -m raw -a "hostnamectl set-hostname h2"
ansible 192.168.6.63 -m raw -a "hostnamectl set-hostname h3"
ansible 192.168.6.64 -m raw -a "hostnamectl set-hostname h4"
ansible all -m raw -a "echo '192.168.6.61 h1' >>/etc/hosts"
ansible all -m raw -a "echo '192.168.6.62 h2' >>/etc/hosts"
ansible all -m raw -a "echo '192.168.6.63 h3' >>/etc/hosts"
ansible all -m raw -a "echo '192.168.6.64 h4' >>/etc/hosts"
ansible all -m raw -a "systemctl stop firewalld"
ansible all -m raw -a "systemctl disable firewalld"
#关闭seliunx
ansible all -m raw -a "sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config"
ansible all -m raw -a "setenforce 0"
?内核参数swappiness用于控制系统在内存紧张时将内存中的数据交换到硬盘交换空间(swap)中 ,一般而言,swappiness值可以设置在 0 到 100 之间。内核版本3.5及以上、Red Hat内核版本2.6.32-303及以上推荐设置一个比较小的值,而不要禁用交换。
ansible all -m raw -a "echo \"vm.swappiness=10\">> /etc/sysctl.conf"DD
#ansible all -m raw -a "echo \"net.ipv6.conf.all.disable_ipv6 = 1\">> /etc/sysctl.conf"
ansible all -m raw -a "sysctl -p"
#临时关闭
ansible all -m raw -a "echo never > /sys/kernel/mm/transparent_hugepage/defrag"
ansible all -m raw -a "echo never > /sys/kernel/mm/transparent_hugepage/enabled"
#永久关闭,每个节点添加
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
#验证查看,如果是never则表示成功。
ansible all -m raw -a "cat /sys/kernel/mm/transparent_hugepage/defrag;cat /sys/kernel/mm/transparent_hugepage/enabled"
#授权
ansible all -m raw -a "chmod +x /etc/rc.local"
?用户的进程和文件句柄数配置文件是/etc/security/limits.conf,类型包括硬限制(hard)和软限制(soft),*表示所有用户,nproc表示打开最大进程数,nofile表示最大文件句柄数。Cloudera推荐最大进程数nproc为65536或26214。
ansible all -m raw -a"echo '* soft nproc 65535' >> /etc/security/limits.conf"
ansible all -m raw -a "echo '* hard nproc 65535' >> /etc/security/limits.conf"
ansible all -m raw -a "echo '* soft nofile 65535' >> /etc/security/limits.conf"
ansible all -m raw -a "echo '* hard nofile 65535' >> /etc/security/limits.conf"
#查看是否生效
ansible all -m raw -a "ulimit -a"
?Linux文件系统会保留记录每个文件访问时间的元数据,这可能会导致即使是读取操作也会导致磁盘写入。为了提高文件读取性能,Cloudera建议在/etc/fstab配置文件中使用noatime挂载选项来禁用atime选项。
# 数据目录添加noatime
ansible all -m raw -a "sed -i 's/\/data ext4 defaults/\/data ext4 defaults,noatime/' /etc/fstab"
# 重新挂载不需要重启节点
#mount -o remount /data
【阿里下载地址】http://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/
#上传
mkdir -p /data/isos
cd /data/isos
rz
#挂载centos7镜像
mkdir /mnt/cdrom
chmod o+x CentOS-7-x86_64-Everything-2003.iso
mount -t iso9660 /data/isos/CentOS-7-x86_64-Everything-2003.iso /mnt/cdrom
lsblk |grep /mnt/cdrom
#移除自带的源
mkdir -p /etc/yum.repos.d/backup
mv /etc/yum.repos.d/* /etc/yum.repos.d/backup
#新建一个本地yum源
cat > /etc/yum.repos.d/local.repo << EOF
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt/cdrom
gpgcheck=0
enabled=1
EOF
#更新源和缓存
yum clean all && yum makecache
#验证
yum repolist|grep Centos
#检测源
yum remove tree -y
yum install tree -y
# 安装httpd
yum -y install httpd
# 启动
systemctl start httpd
# 开机启动
systemctl enable httpd
#在http服务的静态资源目录创建centos目录
mkdir -p /var/www/html/cdh6.3.1
mkdir /var/www/html/cdh6.3.1/centos
#将centos的镜像文件复制到centos目录
\cp -rf /mnt/cdrom/* /var/www/html/cdh6.3.1/centos
#修改cdh-1的本地centos源的配置
sed -i 's#baseurl=file:///mnt/cdrom#baseurl=file:///var/www/html/cdh6.3.1/centos#g' /etc/yum.repos.d/local.repo
#取消挂载
umount /mnt/cdrom/
#更新h1的源
##刷新源
yum clean all && yum makecache
#验证
yum repolist
#重启http
systemctl restart httpd
可以通过http访问了:http://192.168.6.61/cdh6.3.1/centos/
#移除自带的源
mkdir -p /etc/yum.repos.d/backup
mv /etc/yum.repos.d/* /etc/yum.repos.d/backup
#添加共享源
cat >/etc/yum.repos.d/local.repo << EOF
[c6-media]
name=CentOS-$releasever - Media
baseurl=http://h1/cdh6.3.1/centos/
gpgcheck=0
enabled=1
EOF
#刷新源
yum clean all && yum makecache
验证
yum repolist
#测试源
yum remove -y lsof
#安装
yum install -y lsof
#在/var/www/html创建存放cm包的文件夹和cdh安装包的文件夹
mkdir /var/www/html/cdh6.3.1/{cm,cdh}
#上传CDH6.3.2
rz
unzip CDH6.3.2 -d /opt/
tar -xf /opt/CDH6.3.2/cm6.3.1-redhat7.tar.gz -C /opt/
#移动cdh安装包和元数据文件
cd /opt/CDH6.3.2/
mv CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel manifest.json CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha1 /var/www/html/cdh6.3.1/cdh/
mv /var/www/html/cdh6.3.1/cdh/CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha1 /var/www/html/cdh6.3.1/cdh/CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha
mv /opt/CDH6.3.2/CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha256 /var/www/html/cdh6.3.1/cdh/
#解压移动cm安装包
tar -xf /opt/CDH6.3.2/cm6.3.1-redhat7.tar.gz -C /opt/
mv /opt/cm6.3.1/RPMS/x86_64/* /var/www/html/cdh6.3.1/cm/
#授权
chmod 755 /var/www/html/cdh6.3.1/cm
chmod 755 /var/www/html/cdh6.3.1/cdh
#查看
[root@h1 html]# ls -l /var/www/html/cdh6.3.1/
total 4
drwxr-xr-x. 2 root root 77 Sep 11 21:14 cdh
drwxr-xr-x. 8 root root 220 Sep 11 21:02 centos
drwxr-xr-x. 2 root root 4096 Sep 11 21:18 cm
[root@h1 html]# ls -l /var/www/html/cdh6.3.1/cm
total 1380420
-rw-r--r--. 1 2001 2001 10483568 Sep 25 2019 cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm
-rw-r--r--. 1 2001 2001 1203832464 Sep 25 2019 cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm
-rw-r--r--. 1 2001 2001 11488 Sep 25 2019 cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm
-rw-r--r--. 1 2001 2001 10996 Sep 25 2019 cloudera-manager-server-db-2-6.3.1-1466458.el7.x86_64.rpm
-rw-r--r--. 1 2001 2001 14209868 Sep 25 2019 enterprise-debuginfo-6.3.1-1466458.el7.x86_64.rpm
-rw-rw-r--. 1 2001 2001 184988341 Sep 25 2019 oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm
[root@localhost CDH6.3.2]# ls -l /var/www/html/cdh6.3.1/cdh/
total 2033432
-rw-r--r--. 1 root root 2082186246 Jan 8 2021 CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel
-rw-r--r--. 1 root root 40 Jan 11 2021 CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha
-rw-r--r--. 1 root root 64 Jan 11 2021 CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha256
-rw-r--r--. 1 root root 33887 Jan 11 2021 manifest.json
#查看
yum install tree -y
tree /var/www/html/
# 生成repodata文件夹
mv /etc/yum.repos.d/backup/CentOS-Base.repo /etc/yum.repos.d/
yum clean all && yum makecache
yum install -y createrepo
cd /var/www/html/cdh6.3.1/cm/
createrepo .
cd /var/www/html/cdh6.3.1/cdh/
createrepo .
systemctl restart httpd
访问浏览器:http://192.168.6.61/cdh6.3.1/cm/
cat >/etc/yum.repos.d/cloudera-manager.repo<<EOF
[base-local]
name=cm-local
baseurl=file:///var/www/html/cdh6.3.1/cm
enabled=1
gpgcheck=0
EOF
#刷新源
yum clean all && yum makecache
#检测本地源是否配置成功
yum repolist|grep cm-local
cat >/etc/yum.repos.d/cloudera-manager.repo<<EOF
[base-local]
name=cm-local
baseurl=http://h1/cdh6.3.1/cm
enabled=1
gpgcheck=0
EOF
#刷新源
yum clean all && yum makecache
#检测本地源是否配置成功
yum repolist|grep cm-local
cat >/etc/yum.repos.d/cdh-local.repo<<EOF
[cdh-local]
name=cdh-local
baseurl=file:///var/www/html/cdh6.3.1/cdh
enabled=1
gpgcheck=0
EOF
#刷新源
yum clean all && yum makecache
#检测本地源是否配置成功
yum repolist|grep cdh-local
cat >/etc/yum.repos.d/cdh-local.repo<<EOF
[cdh-local]
name=cdh-local
baseurl=http://h1/cdh6.3.1/cdh
enabled=1
gpgcheck=0
EOF
#刷新源
yum clean all && yum makecache
?Centos7默认使用Chrony工具而非NTP进行时间同步,Chrony和NTP两者有冲突只能选其一,CDH6推荐使用Chrony。
?chrony-2.2.1.tar.gz 下载地址:https://download.tuxfamily.org/chrony/
#硬件时钟设置为UTC
ansible all -m raw -a"timedatectl set-local-rtc 0"
#设置本地时区,显示本地时间
ansible all -m raw -a"timedatectl set-timezone Asia/Shanghai"
#手动加载RTC设置
ansible all -m raw -a"hwclock --systohc"
#查看时间
ansible all -m raw -a"timedatectl"
#安装
ansible all -m raw -a"yum -y install chrony"
ansible all -m raw -a"systemctl start chronyd"
#修改服务器配置?件
cp /etc/chrony.conf /etc/chrony.$(date +'%s')
cat > /etc/chrony.conf <<EOF
#编辑该行,设置ntp服务器地址,pool.ntp.org 替换为ntp服务器地址,注:保留1个即可,其他NTP服务器地址注销
pool pool.ntp.org iburst
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
allow 0.0.0.0/0
local stratum 10
logdir /var/log/chrony
EOF
#看正确时间,进行修改
date -s 09:57:00
#同步到硬件时间
clock -w
#启动chronyd
systemctl restart chronyd
systemctl enable chronyd
#安装
yum -y install chrony
# 修改服务器配置文件,以阿里云时间服务器为上游服务器
cp /etc/chrony.conf /etc/chrony.$(date +'%s')
cat > /etc/chrony.conf <<EOF
server 192.168.6.61 iburst
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
logdir /var/log/chrony
EOF
# 启动 chronyd服务
systemctl restart chronyd
systemctl enable chronyd
#重启后等几分钟,让系统识别到时间服务器,期间可多次执行chronyc sources或chronyc sources -v查询状态。
[root@localhost yum.repos.d]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* h1 3 6 377 4 +874us[+1148us] +/- 49ms
[root@localhost ~]# timedatectl
Local time: Mon 2023-12-11 10:05:51 CST
Universal time: Mon 2023-12-11 02:05:51 UTC
RTC time: Mon 2023-12-11 02:05:51
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
#上传到ansible管理节点
rz #jdk-8u131-linux-x64.tar.gz
#拷贝到各个节点
ansible all -m copy -a "src=jdk-8u131-linux-x64.tar.gz dest=/root/jdk-8u131-linux-x64.tar.gz"
#安装jdk
tar -xzf /root/jdk-8u131-linux-x64.tar.gz
mkdir -p /usr/java/
mv jdk1.8.0_131/ /usr/java/
#、配置JAVA环境变量,/etc/profile配置文件中末尾加入如下代码
cp /etc/profile /etc/profile.bak
cat >>/etc/profile<<EOF
#################################################################
export JAVA_HOME=/usr/java/jdk1.8.0_131
export CLASSPATH=\$CLASSPATH:\$JAVA_HOME/lib:\$JAVA_HOME/jre/lib
export PATH=\$JAVA_HOME/bin:\$JAVA_HOME/jre/bin:\$PATH:\$HOMR/bin
##################################################################
EOF
#执行如下代码使其环境变量,并查看环境变量,命令如下:
source /etc/profile
java -version
#检测mysql,有则卸载
rpm -qa | grep -i mysql
rpm -qa|grep mariadb
#yum list installed | grep mariadb
#rpm -e --nodeps mariadb-libs-xxx
#rm -rf /etc/my.cnf
#查找指令rpm方式:rpm -qa|grep mysql
#查找指令yum方式:yum list installed | grep mysql
#find查看指令:find / -name mysql
#whereis查看指令:whereis mysql
#删除指令:rm -rf /etc/selinux/targeted/active/modules/100/mysql
#删除指令:rm -rf /usr/lib64/mysql
#noarch表示该软件包不依赖特定Linux发行版
wget -c https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm --no-check-certificate
rpm -ivh mysql57-community-release-el7-11.noarch.rpm ##安装Yum源配置文件
yum -y install mysql-community-server --nogpgcheck #安装MySQL服务器, --nogpgcheck跳过源认证。
systemctl start mysqld&&systemctl enable mysqld&&systemctl status mysqld #启动MySQL服务器
grep "password" /var/log/mysqld.log #获取临时密码
#登录改密码
[root@h1 ~]# grep "password" /var/log/mysqld.log #获取临时密码
2023-04-18T07:39:06.811617Z 1 [Note] A temporary password is generated for root@localhost: eR-UFk;F<8UD
[root@h1 ~]# mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root: #输入密码:eR-UFk;F<8UD
The existing password for the user account root has expired. Please set a new password.
New password: Abcd$12356A
Re-enter new password: Abcd$12356A
# 移除匿名用户
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
# 禁用远程root登录
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
# 删除测试数据库及权限
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
# 重新加载授权表
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!
#登录
mysql -uroot -p
输入密码:Abcd$12356A
#设置开机启动和重启
systemctl enable mysqld&&systemctl restart mysqld
# 授权,all表示所有ddl和dml操作权限,*.*表示针对所有数据库所有表,%表示本机和远程主机均能访问
grant all privileges on *.* to 'root'@'%' identified by 'Abcd$12356A' with grant option;
# 刷新权限
flush privileges;
#退出
exit
#测试远程访问
yum install mysql -y
mysql -P 3306 -h 192.168.6.61 -uroot -p
输入密码:Abcd$12356A
#卸载MySQL之前,首先需要停止MySQL服务
systemctl stop mysqld
#卸载MySQL软件包
yum -y remove mysql-server mysql-client mysql-common mysql-libs
#删除配置文件
rm -rf /var/lib/mysql
rm -rf /etc/my.cnf
#卸载Yum源配置文件
rpm -e mysql57-community-release-el7-11.noarch
#清理MySQL用户和组
userdel mysql
groupdel mysql
#清理MySQL日志文件和临时文件
rm -rf /var/log/mysql
rm -rf /tmp/mysql*
#配置JDBC驱动包
cd /root/
wget -c https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz --no-check-certificate
tar -xf mysql-connector-java-5.1.46.tar.gz
mv mysql-connector-java-5.1.46/mysql-connector-java-5.1.46.jar /root/mysql-connector-java.jar
#创建目录
ansible all -m raw -a 'mkdir -p /usr/share/java/'
# 复制到各个节点
ansible all -m copy -a 'src=/root/mysql-connector-java.jar dest=/usr/share/java/'
# 修改权限
ansible all -m raw -a 'cd /usr/share/java;chmod 775 mysql-connector-java.jar'
# 验证是否创建成功
ansible all -m raw -a 'ls -l /usr/share/java'
WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
注意此处有坑:对于MySQL5.7高版本,启动CM Server连接MySQL时可能会报com.mysql.jdbc.exceptions.jdbc4.CommunicationsException异常,原因是默认开启了SSL认证,相当于useSSL=true,解决方法就是在配置中添加skip-ssl重启MySQL服务,另外[mysqld_safe]配置项已废弃不用,以下的配置均已经过验证。
[mysqld]
# 务必禁用掉ssl,相当于useSSL=false
skip-ssl
#和重启
systemctl restart mysqld
#登录
mysql -uroot -p
输入密码:Abcd$12356A
#创建
CREATE DATABASE scm DEFAULT CHARACTER SET UTF8;
CREATE USER scm@'%' IDENTIFIED WITH mysql_native_password BY 'Abcd$12356A';
GRANT ALL PRIVILEGES ON scm.* TO scm@'%';
CREATE DATABASE hive DEFAULT CHARACTER SET UTF8;
CREATE USER hive@'%' IDENTIFIED WITH mysql_native_password BY 'Abcd$12356A';
GRANT ALL PRIVILEGES ON hive.* TO hive@'%';
FLUSH PRIVILEGES;
SELECT user,host,plugin FROM mysql.user;
exit
# scm
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'Abcd$12356A';
# amon
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'Abcd$12356A';
# rman
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'Abcd$12356A';
# hue
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'Abcd$12356A';
# hive
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY 'Abcd$12356A';
# sentry
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY 'Abcd$12356A';
# nav
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY 'Abcd$12356A';
# navms
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY 'Abcd$12356A';
# oozie
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'Abcd$12356A';
# 最后刷新一下权限
flush privileges;
# 检查
show databases;
yum install mysql-community-libs-compat-5.7.44-1.el7.x86_64 -y --nogpgcheck
#h1安装server和agent
yum -y install cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server
#安装报错,使用网络源
cd /etc/yum.repos.d
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all&&yum makecache
#MySQL报错 Failing package is: mysql-community-libs-compat-5.7.44-1.el7.x86_64
yum install mysql-community-libs-compat-5.7.44-1.el7.x86_64 -y --nogpgcheck
#h2安装agent
yum -y install cloudera-manager-agent cloudera-manager-daemons
#h3安装agent
yum -y install cloudera-manager-agent cloudera-manager-daemons
#h4安装agent
yum -y install cloudera-manager-agent cloudera-manager-daemons
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm
输入密码:Abcd$12356A
#/opt/cloudera/cm/schema/scm_prepare_database.sh mysql -h 192.168.6.65 --scm-host 192.168.6.61 scm scm Abcd$12356A
#替换
sed -i s'#com.cloudera.cmf.db.host=localhost#com.cloudera.cmf.db.host=h1#'g /etc/cloudera-scm-server/db.properties
#查看
[root@h1 ~]# cat /etc/cloudera-scm-server/db.properties
com.cloudera.cmf.db.type=mysql
com.cloudera.cmf.db.host=h1
com.cloudera.cmf.db.name=scm
com.cloudera.cmf.db.user=scm
com.cloudera.cmf.db.setupType=EXTERNAL
com.cloudera.cmf.db.password=Abcd$12356A
systemctl restart cloudera-scm-server
systemctl status cloudera-scm-server -l
netstat -tnlp|grep 7180
tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log
cp -r /var/www/html/cdh6.3.1/cdh/* /opt/cloudera/parcel-repo/
groupadd cloudera-scm&&useradd -r -g cloudera-scm cloudera-scm
chown -R cloudera-scm:cloudera-scm /opt/cloudera
ansible all -m raw -a "sed -i 's/server_host=localhost/server_host= h1/g' /etc/cloudera-scm-agent/config.ini"
cd /var/www/html/cdh6.3.1/cm
rz
allkeys.asc
【提示】
/tmp/scm_prepare_node.4jhFYJdo
http://192.168.101.105/cdh6/6.3.1/parcels/allkeys.asc
【解决】
上传allkeys.asc到cm的目录下
如果出现"主机运行状况不良"
【报错】
Parcel not distributed but have active state ACTIVATING
[root@localhost ~]# curl -u admin:admin "http://h1:7180/api/v18/clusters"
[root@h1 ~]# curl -u admin:admin -X POST http://192.168.6.61:7180/api/v18/clusters/Cluster1/parcels/products/CDH6/versions/6.3.2-1.cdh6.3.2.p0.1605554/commands/deactivate
【解决】
https://blog.51cto.com/u_14049791/5701635
【报错】
cdh6安装过程报错 failure due to stall on seeded torrent
【解决】
#找到报错节点重启
systemctl restart cloudera-scm-agent.service
先点击 Inspect Network Performance 再点击 Inspect Hosts
注意:没有黄色提示才能继续下一步,否则需要解决。
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| amon |
| hive |
| hue |
| metastore |
| mysql |
| nav |
| navms |
| oozie |
| performance_schema |
| rman |
| scm |
| sentry |
| sys |
+--------------------+