https://www.jianshu.com/p/efd24d0695a3
https://blog.csdn.net/qq_39295044/article/details/87439015
主要看官方文档: https://docs.cloudera.com/documentation/enterprise/6/6.3/topics/cm_intro_primer.html
现在 cdh官方不提供下载 并且6.3.2 之后要收费
规划:
tnode1 cm server + cm agent 4c8g
tnode2 cm agent 4c6g
tnode3 cm agent 4c6g
tnode4 cm agent 4c6g
1、 hosts
hostnamectl
vim /etc/hosts
免密钥登录
ssh-keygen
for ip in {71..74}; do /server/script/sendkey.sh 192.168.11.$ip;done
2、安装ntp
yum install ntp -y
systemctl enable ntpd
和第一个节点时间同步
ansible -i hosts all -m lineinfile -a "path=/etc/ntp.conf regexp='^server 192.168.11.71' insertafter='^server 3.centos.pool.ntp.org iburst' line='server 192.168.11.71' "
systemctl start ntpd
3、 python2.7
3.1、禁用大页
ansible -i hosts all -m shell -a "echo never > /sys/kernel/mm/transparent_hugepage/defrag"
ansible -i hosts all -m shell -a "echo never > /sys/kernel/mm/transparent_hugepage/enabled"
4、 数据库mysql 5.6 (我用5.7)
5、 安装jdk
JDK 必须安装在 /usr/java/ jdk-version.
支持的jdk版本:https://docs.cloudera.com/documentation/enterprise/6/release-notes/topics/rg_java_requirements.html#concept_ugf_4sg_5gb
ansible-playbook -i hosts jdk.yml
./cmd.sh source /etc/profile && java -version
6、 所有主机安装mysql jdbc驱动
/cmd.sh mkdir -p /usr/share/java
上传jdbc包 sz
ansible -i hosts all -m copy -a "src=mysql-connector-java.jar dest=/usr/share/java/"
查看结果
./cmd.sh ls -l /usr/share/java
7、 配置数据库 (以下数据库其实只需要scm就可以了,其他的按需创建)
create user scm identified by 'scm@123456';
create database scm;
create database amon;
create database rman;
create database hue;
create database metastore;
create database sentry;
create database nav ;
create database navms;
create database oozie;
grant all on scm.* to 'scm'@'%' identified by 'scm@123456';
grant all on amon.* to 'scm'@'%' identified by 'scm@123456';
grant all on rman.* to 'scm'@'%' identified by 'scm@123456';
grant all on hue.* to 'scm'@'%' identified by 'scm@123456';
grant all on metastore.* to 'scm'@'%' identified by 'scm@123456';
grant all on sentry.* to 'scm'@'%' identified by 'scm@123456';
grant all on nav.* to 'scm'@'%' identified by 'scm@123456';
grant all on navms.* to 'scm'@'%' identified by 'scm@123456';
grant all on oozie.* to 'scm'@'%' identified by 'scm@123456';
8、 安装CM server
上传和分发文件
./cmd.sh mkdir -p /server/tools/cdh
ansible -i hosts all -m synchronize -a "src=cloudera-manager-daemons-6.3.0-1281944.el7.x86_64.rpm dest=/server/tools/cdh/"
ansible -i hosts all -m synchronize -a "src=cloudera-manager-server-6.3.0-1281944.el7.x86_64.rpm dest=/server/tools/cdh/"
ansible -i hosts all -m synchronize -a "src=cloudera-manager-agent-6.3.0-1281944.el7.x86_64.rpm dest=/server/tools/cdh/"
所有节点安装 daemons
ansible -i hosts all -m shell -a "source /etc/profile && cd /server/tools/cdh && rpm -ivh cloudera-manager-daemons-6.3.0-1281944.el7.x86_64.rpm --nodeps --force"
第一个节点安装server
rpm -ivh cloudera-manager-server-6.3.0-1281944.el7.x86_64.rpm --nodeps --force
所有节点安装agent
ansible -i hosts all -m shell -a "source /etc/profile && cd /server/tools/cdh && rpm -ivh cloudera-manager-agent-6.3.0-1281944.el7.x86_64.rpm --nodeps --force"
会自动生成service文件
cloudera-scm-agent.service 在 /usr/lib/systemd/system/目录下
查看service文件:
./cmd.sh ls -l /usr/lib/systemd/system/cloudera*
并且第一个节点会自动产生数据库脚本文件
[root@tnode1 cdh]# ls /opt/cloudera/cm/schema/scm_prepare_database.sh
/opt/cloudera/cm/schema/scm_prepare_database.sh
修改数据库连接配置:
下面这个步骤就是生成一个/etc/cloudera-scm-server/db.properties 数据库的配置文件,没有生成任何的表
[root@tnode1 cdh]# /opt/cloudera/cm/schema/scm_prepare_database.sh -h 192.168.11.200 -P 52100 mysql scm scm scm@123456
===============多余配置scm_prepare_database.sh会自动生成================
sudo vim /etc/cloudera-scm-server/db.properties
ansible -i hosts 192.168.11.71 -m shell -a "cp /etc/cloudera-scm-server/db.properties /etc/cloudera-scm-server/db.properties.bak"
ansible -i hosts 192.168.11.71 -m lineinfile -a "path=/etc/cloudera-scm-server/db.properties regex='^com.cloudera.cmf.db.host=' insertafter='^#com.cloudera.cmf.db.host=localhost' line='com.cloudera.cmf.db.host=192.168.11.200:52100' "
ansible -i hosts 192.168.11.71 -m lineinfile -a "path=/etc/cloudera-scm-server/db.properties regex='^com.cloudera.cmf.db.name=cmf' insertafter='#com.cloudera.cmf.db.name=cmf' line='com.cloudera.cmf.db.name=scm' "
ansible -i hosts 192.168.11.71 -m lineinfile -a "path=/etc/cloudera-scm-server/db.properties regex='^com.cloudera.cmf.db.user=cmf' insertafter='#com.cloudera.cmf.db.user=cmf' line='com.cloudera.cmf.db.user=scm' "
ansible -i hosts 192.168.11.71 -m lineinfile -a "path=/etc/cloudera-scm-server/db.properties regex='^com.cloudera.cmf.db.password=' insertafter='#com.cloudera.cmf.db.password=' line='com.cloudera.cmf.db.password=scm@123456' "
ansible -i hosts 192.168.11.71 -m lineinfile -a "path=/etc/cloudera-scm-server/db.properties regex='^com.cloudera.cmf.db.setupType=' line='com.cloudera.cmf.db.setupType=EXTERNAL' "
===============多余配置================
修改所有agent的server_host
ansible -i hosts all -m shell -a "cp /etc/cloudera-scm-agent/config.ini /etc/cloudera-scm-agent/config.ini.bak"
ansible -i hosts all -m lineinfile -a "path=/etc/cloudera-scm-agent/config.ini regex='^server_host=' line='server_host=tnode1' "
查看修改结果
ansible -i hosts all -m shell -a "cat /etc/cloudera-scm-agent/config.ini |grep "server_host""
parcel本地仓库搭建: 可选httpd
文档:https://docs.cloudera.com/documentation/enterprise/6/6.3/topics/cm_ig_create_local_parcel_repo.html#parcel_repo_web_server
mkdir -p /opt/cloudera/parcel-repo &&cd /opt/cloudera/parcel-repo
[root@tnode1 parcel-repo]# cp /server/tools/cdh/CDH-6.3.0-1.cdh6.3.0.p0.1279813-el7.parcel* .
[root@tnode1 parcel-repo]# cp /server/tools/cdh/manifest.json .
sudo chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo/*
上面的账号在之前步骤已经自动创建
第一个节点启动server:
修改server service添加JAVA_HOME
==========多余步骤=============
ansible -i hosts 192.168.11.71 -m lineinfile -a "path=/usr/lib/systemd/system/cloudera-scm-server.service regex='^Environment=JAVA_HOME=/usr/java/jdk1.8.0_131' insertafter='Environment=CMF_DEFAULTS=/etc/default/cloudera-scm-server' line='Environment=JAVA_HOME=/usr/java/jdk1.8.0_131' "
systemctl daemon-reload
systemctl start cloudera-scm-server
假如ll /var/log/cloudera-scm-server/ 目录下没有日志 并且启动失败
则 journalctl -f 重启server 就能看到具体的报错 我的是报JAVA JDK版本问题
查看日志
tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log 有下面这句话则表示已经启动成功
2021-06-19 10:12:37,652 INFO WebServerImpl:com.cloudera.server.cmf.WebServerImpl: Started Jetty server.
并且查看数据库scm中创建了相关的表
所有节点启动agent
修改agent service添加JAVA_HOME
==========多余步骤=============
ansible -i hosts all -m lineinfile -a "path=/usr/lib/systemd/system/cloudera-scm-agent.service regex='^Environment=JAVA_HOME=/usr/java/jdk1.8.0_131' insertafter='EnvironmentFile=-/etc/default/cloudera-scm-agent' line='Environment=JAVA_HOME=/usr/java/jdk1.8.0_131' "
查看修改结果 ./cmd.sh cat /usr/lib/systemd/system/cloudera-scm-agent.service
./cmd.sh systemctl daemon-reload && ./cmd.sh systemctl start cloudera-scm-agent
访问: 192.168.11.71:7180