系统环境:
Centos: 7.5.1804
JDK: 1.8.0_191
MySQL: 5.7
Cloudera Manager 下载目录:http://archive.cloudera.com/cm5/cm/5/
CDH 下载目录:http://archive.cloudera.com/cdh5/parcels/5.15.0/
manifest.json:http://archive.cloudera.com/cdh5/parcels/5.15.0/manifest.json
CHD5 相关的 Parcel 包放到主节点的/opt/cloudera/parcel-repo/目录中,
否则,系统会重新下载 CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel 文件。
准备文件:
- cloudera-manager-centos7-cm5.15.0_x86_64.tar.gz
- CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel
- CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel.sha1
各机器信息:
主机名 | ip地址 | 安装服务 |
---|---|---|
master (Master,Agent) | 192.168.206.201 | jdk、cloudera-manager、MySQL |
node1 (Agents) | 192.168.206.202 | jdk、cloudera-manager |
node2 (Agents) | 192.168.206.203 | jdk、cloudera-manager |
1. 安装 CM Server & Agent[1]
- 在所有节点,创建/opt/cloudera-manager
可以直接利用第二节的ops_command.sh和scp_file.sh脚本,master上执行:$ /opt/ops_command.sh 'mkdir -p /opt/cloudera-manager'
- 上传解压安装包
把下载好的cloudera-manager-centos7-cm5.15.0_x86_64.tar.gz安装包上传至 node1 节点/opt/目录,然后node1上执行:$ /opt/scp_file.sh '/opt/cloudera-manager-centos7-cm5.15.0_x86_64.tar.gz' $ tar xvzf /opt/cloudera-manager*.tar.gz -C /opt/cloudera-manager $ /opt/ops_command.sh 'tar xvzf /opt/cloudera-manager*.tar.gz -C /opt/cloudera-manager'
2. 创建用户 cloudera-scm(所有节点)[2]
Cloudera管理器服务器和托管服务被配置为在默认情况下使用用户帐户Cloudera-scm,创建具有这个名称的用户是最简单的方法。创建用户,在安装完成后自动使用。
$ useradd --system --home=/opt/cloudera-manager/cm-5.15.0/run/cloudera-scm-server/ --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
$ /opt/ops_command.sh 'useradd --system --home=/opt/cloudera-manager/cm-5.15.0/run/cloudera-scm-server/ --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm'
3. 配置 CM Agent[3]
修改master节点
$ vim /opt/cloudera-manager/cm-5.15.0/etc/cloudera-scm-agent/config.ini
//修改 server_host的值为master
-------------------------------------------------
# Hostname of the CM server.
server_host=master
-------------------------------------------------
$ ./scp_file.sh /opt/cloudera-manager/cm-5.15.0/etc/cloudera-scm-agent/config.ini
4. 配置 CM Server 的数据库[4]
在master节点初始化CM5的数据库:
- 下载mysql-connector-java 驱动包,我这里直接在阿里云仓库搜索(mysql-connector-java)下载;
下载完成后上传到 /opt/cloudera-manager/cm-5.15.0/share/cmf/lib - 启动mysql服务
- 使用安装包脚本初始化数据库
# 脚本格式: scm_prepare_database.sh mysql -h [数据库ip地址或者主机名] -uroot -p[root密码] --scm-host [数据库ip地址或者主机名] [cm数据库名称] [数据库用户名] [数据库密码]
# 指定的[cm数据库名称] 数据库一定不存在
$ /opt/cloudera-manager/cm-5.15.0/share/cmf/schema/scm_prepare_database.sh mysql -h master -uroot -p123456 --scm-host master scm xuchang 123456
[2019-08-25 00:25:28,279] INFO 0[main] - com.cloudera.enterprise.dbutil.DbCommandExecutor.testDbConnection(DbCommandExecutor.java) - Successfully connected to database.
All done, your SCM database is configured correctly!
5. 离线安装[5]
- Manager 也就是master节点创建目录/opt/cloudera/parcel-repo,CDH默认的parcel离线包存放目录,将下载好的离线文件放入该目录:
$ mkdir -p /opt/cloudera/parcel-repo
$ chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo
# CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel
# CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel.sha1
# manifest.json
#重命名
$ mv CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel.sha1 CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel.sha
- Agent (node1、node2)节点创建 /opt/cloudera/parcels目录
$ ./ops_command.sh 'mkdir -p /opt/cloudera/parcels'
$ ./ops_command.sh 'chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcels'
- 启动服务
# master上执行:
$ /opt/cloudera-manager/cm-5.15.0/etc/init.d/cloudera-scm-server start
[root@master opt]# /opt/cloudera-manager/cm-5.15.0/etc/init.d/cloudera-scm-server start
Starting cloudera-scm-server: [ 确定 ]
--------------------------------------------------------------------------------------------
$ /opt/cloudera-manager/cm-5.15.0/etc/init.d/cloudera-scm-agent start
$ ./ops_command.sh '/opt/cloudera-manager/cm-5.15.0/etc/init.d/cloudera-scm-agent start'
[root@master opt]# ./ops_command.sh '/opt/cloudera-manager/cm-5.15.0/etc/init.d/cloudera-scm-agent start'
exe command /opt/cloudera-manager/cm-5.15.0/etc/init.d/cloudera-scm-agent start
Starting cloudera-scm-agent: [ 确定 ]
Starting cloudera-scm-agent: [ 确定 ]
Manager 启动成功需要等待一段时间,过程中会在数据库中创建对应的表需要耗费一些时间,稍等即可访问 master:7180,账号/密码: admin/admin
日志文件可以查看,
Manager: /opt/cloudera-manager/cm-5.15.0/log/cloudera-scm-server/
Agent: /opt/cloudera-manager/cm-5.15.0/log/cloudera-scm-agent/
恭喜安装成功!!!
6. CDH5群集设置[6]
- 欢迎使用 Cloudera Manager
最终用户许可条款和条件,(同意直接,继续) - 部署哪个版本?(第一个免费版本,继续)
- 感谢您选择 Cloudera Manager 和 CDH(继续)
- 为 CDH 群集安装指定主机(tab切换当前管理的主机: master,node1,node2; 全选,继续)
-
群集安装,选择存储库(按下图选择已经下载好的离线包,继续)
-
正在安装选定 Parcel(等安装完成,继续)
- 群集安装,检查主机正确性(继续)
- 群集设置,Select Services(核心 Hadoop或者按自己的需求选择,继续)
- 群集设置,数据库设置(需要创建对应的数据库,和用户,继续)
官方建议:
Databases for Cloudera Software
Service | Database | User |
---|---|---|
Cloudera Manager Server | scm | scm |
Activity Monitor | amon | amon |
Reports Manager | rman | rman |
Hue | hue | hue |
Hive Metastore Server | metastore | hive |
Sentry Server | sentry | sentry |
Cloudera Navigator Audit Server | nav | nav |
Cloudera Navigator Metadata Server | navms | navms |
Oozie | oozie | oozie |
群集设置,审核更改(按需设置或者直接,继续)
-
群集设置,首次运行 命令(步骤失败看日志stderr,解决错误后Resume)
1. Error: JAVA_HOME is not set and Java could not be found
解决思路: 查看完整日志文件从开始浏览一遍,发现JAVA_HOME是在Shell脚本/opt/cloudera-manager/cm-5.15.0/lib64/cmf/service/common/cloudera-config.sh中读取的,编辑cloudera-config.sh这个文件JAVA8_HOME_CANDIDATES=( '/usr/java/jdk1.8' '/usr/java/jre1.8' '/usr/lib/jvm/j2sdk1.8-oracle' '/usr/lib/jvm/j2sdk1.8-oracle/jre' '/usr/lib/jvm/java-8-oracle' '/opt/jdk1.8.0_191' #这是加进去的 ) $ ./scp_file.sh /opt/cloudera-manager/cm-5.15.0/lib64/cmf/service/common/cloudera-config.sh
如果后面有此类错误,按照这个思路去解决
-
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to load driver
mysql数据库驱动没找到,之前下载的mysql-connector-java复制一份(其它组件依赖mysql的,同样方法复制一份到组件的lib目录下)
$ cp /opt/cloudera-manager/cm-5.15.0/share/cmf/lib/mysql-connector-java-5.1.9.jar /opt/cloudera/parcels/CDH-5.15.0-1.cdh5.15.0.p0.21/lib/hive/lib/
彻底解决(组件安装找不到mysql jdbc驱动,会去/user/share/java目录找),放一份到 复制一份重命名 /usr/share/java/mysql-connector-java.jar
$ cp /opt/cloudera-manager/cm-5.15.0/share/cmf/lib/mysql-connector-java-5.1.9.jar /usr/share/java/mysql-connector-java.jar
-