# cdh 6.3.2部署安装
## 版本信息
| 节点 | ip地址 | mysql | parcel文件离线源 | cm | cdh |
| ------- | --------------------------------------- | -------- | ----------- | ----- | ----- |
| hadoop1 | 172.31.66.128 172.31.182.223 | | parcel | 6.3.1 | 6.3.2 |
| hadoop2 | 172.31.66.129 | mysql5.7 | | 6.3.1 | 6.3.2 |
| hadoop3 | 172.31.66.130 | | | 6.3.1 | 6.3.2 |
## 下载地址
### cm 6.3.1
```
https://archive.cloudera.com/cm6/6.3.1/repo-as-tarball/cm6.3.1-redhat7.tar.gz
```
### cdh 6.3.2
```
https://archive.cloudera.com/cdh6/6.3.2/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel
https://archive.cloudera.com/cdh6/6.3.2/parcels/CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha1
https://archive.cloudera.com/cdh6/6.3.2/parcels/manifest.json
```
### jdk
```
https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html
```
### mysql
```
https://dev.mysql.com/downloads/mysql/5.7.html#downloads
```
### mysql jdbc jar:
```
https://dev.mysql.com/downloads/connector/j/
```
## 环境部署
### 1 修改集群节点基本信息
```
修改集群节点hadoop1信息:
1 hostnamectl set-hostname hadoop1.example.com
2 设置所有节点的hosts文件
172.31.66.128 hadoop1.example.com hadoop1
172.31.66.129 hadoop2.example.com hadoop2
172.31.66.130 hadoop3.example.com hadoop3
3 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
4 修改selinux配置信息
vim /etc/selinux/config
将selinux=enforcing改为disabled
5 设置集群各节点之间免秘钥登录
ssh-keygen
ssh-copy-id root@hadoop2
ssh-copy-id root@hadoop3
集群节点hadoop2、hadoop3参照节点1的部署修改基本信息
```
### 2 设置集群时钟同步
```
所有节点安装ntp
yum install ntp
修改ntp服务器配置,将所有节点的ntp同步指向hadoop1
如下hadoop1服务器ntp配置文件:
driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
server 127.127.1.0 //该行如下面一行表示以本地时钟为同步时钟源
fudge 127.127.1.0 stratum 10
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
You have new mail in /var/spool/mail/root
hadoop2、hadoop3服务器ntp配置文件如下:
driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
server 172.31.66.128 //服务器时钟同步指向hadoop1
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
```
### 3部署jdk
```
hadoop集群所有节点部署jdk
```
### 4 离线安装部署mysql
```
创建cdh的元数据库和用户、amon服务的数据库
create database cmf default character utf8;
create database amon default character set utf8;
grant all on cmf.* to 'cmf'@'%' identified by 'admin123';
grant all on amon.* to 'amon'@'%' identified by 'admin123';
flush privileges;
```
### 5 hadoop1节点部署mysql jdbc jar
```
将下载的jar包安装部署在/usr/share/java目录下,并将其重命名为mysql-connector-java.jar,否则在启动服务的时候会报错
```
### 6 hadoop1节点作为master节点,安装如下安装包(不下载依赖包直接部署)
```
解压下载的cm文件,安装相应的安装包
rpm -ivh cloudera-manager-server-6.3.1-1466458.el7.x86_64.rpm --nodeps --force
rpm -ivh cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm --nodeps --force
rpm -ivh cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm --nodeps --force
安装好相应安装包后修改hadoop1节点angent指向
sed -i "s/server_host=localhost/server_host=hadoop1/g" /etc/cloudera-scm-agent/config.ini
修改主节点server配置
com.cloudera.cmf.db.type=mysql
com.cloudera.cmf.db.host=hadoop2.example.com
com.cloudera.cmf.db.name=cmf
com.cloudera.cmf.db.user=cmf
com.cloudera.cmf.db.password=admin23
com.cloudera.cmf.db.setupType=EXTERNAL
```
### 7 集群中除去Hadoop1节点安装如下安装包
```
解压下载的cm文件,安装相应的安装包
rpm -ivh cloudera-manager-daemons-6.3.1-1466458.el7.x86_64.rpm --nodeps --force
rpm -ivh cloudera-manager-agent-6.3.1-1466458.el7.x86_64.rpm --nodeps --force
安装好相应安装包后修改hadoop1节点angent指向
sed -i "s/server_host=localhost/server_host=hadoop1/g" /etc/cloudera-scm-agent/config.ini
```
### 8部署parcel源
```
采用hadoop1作为httpd服务地址
yum install httpd -y
将下载菜单cdh的安装包解压到/var/www/html下
[root@hadoop1 java]# ls /var/www/html/cdh6_parcel
CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel CDH-6.3.2-1.cdh6.3.2.p0.1605554-el7.parcel.sha(注意这个文件) manifest.json
```
### 9启动server服务
```
systemctl start cloudera-scm-server
如果无法启动成功,查看日志进行解决
tailf /var/log/cloudera-scm-server/cloudera-scm-server.log
```
### 10 所有节点启动agent服务
```
systemctl start cloudera-scm-agent
```