Linux本身准备
Linux本事准备需要5个步骤。
- SSH打通
- 配置主机名和HOSTS文件
- 关闭SELinux和防火墙
- 设置Yum国内源
- NTP时间同步
步骤详细
SSH打通
ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.0.3
配置主机名和HOST
设置主机名
配置hostshostnamectl set-hostname foo
cat >> /etc/hosts << EOF
192.168.124.13 tail1
192.168.124.14 tail2
192.168.124.15 tail3
EOF
关闭SELinux和防火墙
echo "HOSTNAME=foo" >>/etc/sysconfig/network
systemctl stop firewalld.service && systemctl disable firewalld.service
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config && setenforce 0
换Yum为国内源
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 http://mirrors.aliyun.com/repo/Centos-7.repo
ntp设置同步
yum install -y ntp && ntpdate time4.aliyun.com
0 23 * * * /usr/sbin/ntpdate ntp2.aliyun.com
Java安装(可选)
#有JPS的openJDK。
yum install java-1.8.0-openjdk-devel.x86_64 -y
Linux内核参数优化(可选)
内存分页交换设置成1(大于0尽可能最小)
echo 1 > /proc/sys/vm/swappiness
CDH安装
配置CentOS配置仓库
所有节点
sudo wget https://archive.cloudera.com/cm5/redhat/7/x86_64/cm/cloudera-manager.repo -P /etc/yum.repos.d/
sudo rpm --import https://archive.cloudera.com/cm5/redhat/7/x86_64/cm/RPM-GPG-KEY-cloudera
主节点安装Manager
管理节点执行如下命令
sudo yum install cloudera-manager-daemons cloudera-manager-server -y
从节点安装Agent
sudo yum install cloudera-manager-daemons cloudera-manager-agent -y
离线安装
https://archive.cloudera.com/cdh5/parcels/5/
下载如下文件
CDH-5.16.2-1.cdh5.16.2.p0.8-el7.parcel
CDH-5.16.2-1.cdh5.16.2.p0.8-el7.parcel.sha1
将文件拷贝到此目录,并把sha1改成sha(要不CDH Manager识别不了)
/opt/cloudera/parcel-repo
https://archive.cloudera.com/cm5/redhat/7/x86_64/cm/5/RPMS/x86_64/
pscp CDH-5.16.2-1.cdh5.16.2.p0.8-el7.parcel /opt/cloudera/parcel-repo
pscp CDH-5.16.2-1.cdh5.16.2.p0.8-el7.parcel.sha1 /opt/cloudera/parcel-repo
mv /opt/cloudera/parcel-repo/CDH-5.16.2-1.cdh5.16.2.p0.8-el7.parcel.sha1 /opt/cloudera/parcel-repo/CDH-5.16.2-1.cdh5.16.2.p0.8-el7.parcel.sha
数据库相关
mysql 5.7密码怎么设置也不能小于4位。所以设置成scm_cdh
sudo /usr/share/cmf/schema/scm_prepare_database.sh mysql -uroot -p scm scm scm_cdh
sudo /usr/share/cmf/schema/scm_prepare_database.sh mysql -uroot -p amon amon amon
sudo /usr/share/cmf/schema/scm_prepare_database.sh mysql -uroot -p metastore hive hive
安装依赖Jar包
一定要5.x.x的jdbc包。
wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.20/mysql-connector-java-8.0.20.jar
wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar
/usr/share/java/mysql-connector-java.jar
wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar -P /usr/share/java/
mv /usr/share/java/mysql-connector-java-5.1.49.jar /usr/share/java/mysql-connector-java.jar
安装JCE(kerberos环境需要)
locate 'jre/lib/security' | grep 'lib/security$'
/usr/java/jdk1.7.0_67-cloudera/jre/lib/security
scp ~/UnlimitedJCEPolicy/*.jar root@cdh1:/usr/java/jdk1.7.0_67-cloudera/jre/lib/security
启动Manager
sudo systemctl start cloudera-scm-server
sudo tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log
less /var/log/cloudera-scm-server/cloudera-scm-server.log
坑
目录找不到
手动创建并
chown foo:foo /foo/bar
主机运行状况不良
rm -f /var/lib/cloudera-scm-agent/cm_guid
sudo service cloudera-scm-agent restart
再不行就把节点从Manager中删除,重新加入集群。
exporty JAVA_HOME=/opt/java
ln -s YOUR_JAVA_HOME /usr/java/default
Cannot find CDH’s bigtop-detect-javahome.
连接外部MySQL
Web选择安装Java
Manager Server启动报错
Caused by: java.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver : Unsupported major.minor version 52.0
一定要5.x.x的jdbc包。CDH5.16是JDK1.7。不支持太高版本MySQL connector。
单用户模式是否开启
不开启单用户模式
连不上DB
看这行日志的上一行。
Unexpected error. Unable to verify database connection.
时钟偏差
有时是未开启ntpd服务。如下命令即可。
systemctl restart ntpd
配置文件
一般不需要修改,排查问题可以看下。
自定义修改scm数据密码的配置文件如下
/etc/cloudera-scm-server/db.properties
com.cloudera.cmf.db.type=mysql
com.cloudera.cmf.db.host=foo
com.cloudera.cmf.db.name=scm
com.cloudera.cmf.db.user=scm
com.cloudera.cmf.db.password=scm_cdh
com.cloudera.cmf.db.setupType=EXTERNAL
agent配置文件位置
/etc/cloudera-scm-agent/config.ini
CDH DB Shell脚本没法执行可以使用下面SQL。创建数据库和用户并赋予权限。
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'hive'@'%' IDENTIFIED BY 'hive';
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'scm';
GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY 'hive';
GRANT ALL privileges on *.* to 'root' @'%' identified by 'root';
flush privileges;
官方文档
https://docs.cloudera.com/documentation/enterprise/5-16-x/topics/installation.html
官方推荐节点分布
https://docs.cloudera.com/documentation/enterprise/5-16-x/topics/cm_ig_host_allocations.html
组件版本
JobHistory
https://stackoverflow.com/questions/47476105/error-starting-jobhistoryserver-on-cloudera-manager
Hive
https://blog.csdn.net/wyzlwyzl/article/details/86546514
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/metastore?createDatabaseIfNotExist=true&useSSL=false</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hive</value>
</property>
开Kerberos
https://blog.csdn.net/u011026329/article/details/79167884
这俩命令可以找到 CDH Manager自动生成keytab的位置
export dirname=/var/run/cloudera-scm-agent/process/
find $dirname -not -empty `-ls -l` | grep keytab
升级JDK8
https://docs.cloudera.com/cdp-private-cloud/latest/upgrade-cdh/topics/ug_jdk8.html
https://cloud.tencent.com/developer/article/1078291