Linux本身准备

Linux本事准备需要5个步骤。

  1. SSH打通
  2. 配置主机名和HOSTS文件
  3. 关闭SELinux和防火墙
  4. 设置Yum国内源
  5. NTP时间同步

    步骤详细

    SSH打通

    1. ssh-keygen -t rsa
    2. ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.0.3

    配置主机名和HOST

    设置主机名
    1. hostnamectl set-hostname foo
    配置hosts
    1. cat >> /etc/hosts << EOF
    2. 192.168.124.13 tail1
    3. 192.168.124.14 tail2
    4. 192.168.124.15 tail3
    5. EOF

关闭SELinux和防火墙

  1. echo "HOSTNAME=foo" >>/etc/sysconfig/network
  2. systemctl stop firewalld.service && systemctl disable firewalld.service
  3. sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config && setenforce 0

换Yum为国内源

  1. mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  2. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

ntp设置同步

  1. yum install -y ntp && ntpdate time4.aliyun.com
  2. 0 23 * * * /usr/sbin/ntpdate ntp2.aliyun.com

Java安装(可选)

  1. #有JPS的openJDK。
  2. yum install java-1.8.0-openjdk-devel.x86_64 -y

Linux内核参数优化(可选)

内存分页交换设置成1(大于0尽可能最小)

  1. echo 1 > /proc/sys/vm/swappiness

CDH安装

配置CentOS配置仓库

所有节点

  1. sudo wget https://archive.cloudera.com/cm5/redhat/7/x86_64/cm/cloudera-manager.repo -P /etc/yum.repos.d/
  2. sudo rpm --import https://archive.cloudera.com/cm5/redhat/7/x86_64/cm/RPM-GPG-KEY-cloudera

主节点安装Manager

管理节点执行如下命令

  1. sudo yum install cloudera-manager-daemons cloudera-manager-server -y

从节点安装Agent

  1. 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/

  1. pscp CDH-5.16.2-1.cdh5.16.2.p0.8-el7.parcel /opt/cloudera/parcel-repo
  2. pscp CDH-5.16.2-1.cdh5.16.2.p0.8-el7.parcel.sha1 /opt/cloudera/parcel-repo
  3. 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包。

  1. wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.20/mysql-connector-java-8.0.20.jar
  2. wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar
  3. /usr/share/java/mysql-connector-java.jar
  4. wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar -P /usr/share/java/
  5. mv /usr/share/java/mysql-connector-java-5.1.49.jar /usr/share/java/mysql-connector-java.jar

安装JCE(kerberos环境需要)

  1. locate 'jre/lib/security' | grep 'lib/security$'
  2. /usr/java/jdk1.7.0_67-cloudera/jre/lib/security
  3. scp ~/UnlimitedJCEPolicy/*.jar root@cdh1:/usr/java/jdk1.7.0_67-cloudera/jre/lib/security

启动Manager

  1. sudo systemctl start cloudera-scm-server
  1. sudo tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log
  2. less /var/log/cloudera-scm-server/cloudera-scm-server.log

目录找不到
手动创建并

  1. chown foo:foo /foo/bar

chown foo:foo

主机运行状况不良

  1. rm -f /var/lib/cloudera-scm-agent/cm_guid
  2. sudo service cloudera-scm-agent restart

再不行就把节点从Manager中删除,重新加入集群。

  1. exporty JAVA_HOME=/opt/java
  2. ln -s YOUR_JAVA_HOME /usr/java/default

Cannot find CDH’s bigtop-detect-javahome.

连接外部MySQL
Web选择安装Java

https://docs.cloudera.com/documentation/enterprise/release-notes/topics/cm_rn_known_issues.html#rn_OPSAPS-34847

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服务。如下命令即可。

  1. systemctl restart ntpd

配置文件

一般不需要修改,排查问题可以看下。
自定义修改scm数据密码的配置文件如下

/etc/cloudera-scm-server/db.properties

  1. com.cloudera.cmf.db.type=mysql
  2. com.cloudera.cmf.db.host=foo
  3. com.cloudera.cmf.db.name=scm
  4. com.cloudera.cmf.db.user=scm
  5. com.cloudera.cmf.db.password=scm_cdh
  6. com.cloudera.cmf.db.setupType=EXTERNAL

agent配置文件位置

/etc/cloudera-scm-agent/config.ini

CDH DB Shell脚本没法执行可以使用下面SQL。创建数据库和用户并赋予权限。

  1. CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
  2. CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
  3. CREATE USER 'hive'@'%' IDENTIFIED BY 'hive';
  4. GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'scm';
  5. GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY 'hive';
  6. GRANT ALL privileges on *.* to 'root' @'%' identified by 'root';
  7. 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

组件版本

https://docs.cloudera.com/documentation/enterprise/release-notes/topics/cdh_vd_cdh_package_tarball_516.html

JobHistory

https://stackoverflow.com/questions/47476105/error-starting-jobhistoryserver-on-cloudera-manager

Hive

https://blog.csdn.net/wyzlwyzl/article/details/86546514

  1. <property>
  2. <name>javax.jdo.option.ConnectionURL</name>
  3. <value>jdbc:mysql://localhost:3306/metastore?createDatabaseIfNotExist=true&amp;useSSL=false</value>
  4. </property>
  5. <property>
  6. <name>javax.jdo.option.ConnectionDriverName</name>
  7. <value>com.mysql.jdbc.Driver</value>
  8. </property>
  9. <property>
  10. <name>javax.jdo.option.ConnectionUserName</name>
  11. <value>hive</value>
  12. </property>
  13. <property>
  14. <name>javax.jdo.option.ConnectionPassword</name>
  15. <value>hive</value>
  16. </property>

开Kerberos

https://blog.csdn.net/u011026329/article/details/79167884

这俩命令可以找到 CDH Manager自动生成keytab的位置

  1. export dirname=/var/run/cloudera-scm-agent/process/
  2. 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