1、部署基本信息说明:
1.1、主机信息
操作系统:选择CentOS6.7 x86-64版本
MEM:64GB,CPU: E5-2630 v3 @ 2.40GHz, DISK:2TB*4(数据节点存储,操作系统除外)
主机信息:
主机名 IP
dcnn1 10.20.20.1
dcnn2 10.20.20.2
dcdn01 10.20.20.3
dcdn02 10.20.20.4
dcdn03 10.20.20.5
1.2、CDH版本信息
ClouderaManager:cm5.7.2
CDH:cdh5.7.2版本
2、部署步骤
2.1
下载安装包
CM parcel离线安装包:5.7.2
http://archive.cloudera.com/cm5/cm/5/cloudera-manager-centos7-cm5.7.2_x86_64.tar.gz
CDH parcel离线安装包:(5.7.2)
http://archive.cloudera.com/cdh5/parcels/5.7/CDH-5.7.2-1.cdh5.7.2.p0.18-el6.parcel
http://archive.cloudera.com/cdh5/parcels/5.7/CDH-5.7.2-1.cdh5.7.2.p0.18-el6.parcel.sha1
http://archive.cloudera.com/cdh5/parcels/5.7/manifest.json
2.2 账号分配
建立安装用户bigdata,用户配置sudo无密码登录权限,后面都以bigdata用户操作,也可以直接用root用户操作
部署管理平台的主机打通到其它主机的ssh免登陆(部署用户,bigdata或者root),这里用bigdata
2.3 主机名设置:
每台主机的/etc/hosts增加所有主机信息,并用hostname命令更改相应主机名
10.20.20.1 dcnn1
10.20.20.2 dcnn2
10.20.20.3 dcdn01
10.20.20.4 dcdn02
10.20.20.5 dcdn03
2.4网络配置(每台主机)
以dcnn1位例
vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=dcnn1
通过service network restart
重启网络服务,生效
2.5关闭IPtables和SELINUX (每台主机)
sudo chkconfig iptables off
sudo /etc/init.d/iptables stop
关闭SELINUX(实际安装过程中发现没有关闭也是可以的,不知道会不会有问题,还需进一步进行验证):
setenforce 0 (临时生效)
修改:/etc/selinux/configx下的 SELINUX=disabled(重启后永久生效)
2.6开启NTP服务
这里因为是和外网隔离的,配置自己的ntpd服务器,ntp服务未安装,请自行安装,一般linux系统会默认安装ntpd服务,但没有启动,没有的可以自行安装
配置ntp server:
1)打开ntp服务配置文件/etc/ntp.conf
2)增加内容
//忽略ntp要求封包
restrict default nomodify notrap
restrict 10.20.20.1 mask 255.255.255.0 nomodify
server 10.20.20.1
//表示NTP主服务器是与自身的系统时钟同步
server 127.127.1.0
//同步上层服务器的stratum 大小不能超过或等于16
fudge 127.127.1.0 stratum 10
3)启动
启动服务:sudo service ntpd start
重启生效:sudo chkconfig ntpd on
配置ntp client:
1)打开ntp服务配置文件/etc/ntp.conf
2)增加内容
server 10.20.20.1
3)启动
启动服务:sudo service ntpd start
重启生效:sudo chkconfig ntpd on
注:ntp服务的配置,生效需要一段时间,我自己测试大概5分钟左右,刚重启ntp服务,检查状态并不一定正常。
2.7安装JDK
我们使用建议版本1.8.0_60
因为CDH需要oracle的java(所有节点)
CentOS自带OpenJdk,不过运行CDH5需要使用Oracle的JDK,需要Java 7以上的支持。
先卸载自带的OpenJdk,使用rpm -qa | grep java
查询java相关的包,使用rpm -e --nodeps 包名
卸载之。
安装: rpm -ivh jdk-8u60-linux-x64.rpm
由于是rpm包并不需要我们来配置环境变量,我们只需要配置一个全局的JAVA_HOME变量即可,执行命令:
echo "JAVA_HOME=/usr/java/latest/" >> /etc/environment
2.8 安装MySQL(安装CentOS6.7自带版本5.1.7)
mysql数据库服务端:
sudo rpm -hvi mysql-5.1.73-5.el6_6.x86_64.rpm
sudo rpm -hvi perl-DBD-MySQL-4.013-3.el6.x86_64.rpm
sudo rpm -hvi mysql-server-5.1.73-5.el6_6.x86_64.rpm
chkconfig mysqld on
设置开机启动,并service mysqld start
启动mysql服务,
并根据提示设置root的初试密码:
mysqladmin -u root password ‘bigdata‘
mysqladmin -u root -h dcnn1 password ‘bigdata‘
mysql数据库客户端:
sudo rpm -hvi mysql-5.1.73-5.el6_6.x86_64.rpm
创建数据库和设置mysql数据库访问权限:
#hive
create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
UPDATE user SET password=PASSWORD(‘hive‘) WHERE user=‘hive‘;
#activity monitor
create database amon DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
UPDATE user SET password=PASSWORD(‘amon‘) WHERE user=‘amon‘;
#oozie
create database oozie DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
UPDATE user SET password=PASSWORD(‘oozie‘) WHERE user=‘oozie‘;
#report
create database report DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
UPDATE user SET password=PASSWORD(‘report‘) WHERE user=‘report‘;
FLUSH PRIVILEGES;
#设置root授权访问以上所有的数据库:
grant all privileges on *.* to ‘root‘@‘dcnn1‘ identified by ‘bigdata‘ with grant option;
flush privileges;
#授权用户在服务端拥有数据库的访问权限
grant all privileges on *.* to ‘oozie‘@‘dcnn1 ‘ identified by ‘oozie‘ with grant option;
grant all privileges on *.* to ‘hive‘@‘dcnn1‘ identified by ‘hive‘ with grant option;
grant all privileges on *.* to ‘amon‘@‘dcnn1 ‘ identified by ‘amon‘ with grant option;
grant all privileges on *.* to ‘report‘@‘dcnn1 ‘ identified by ‘report‘ with grant option;
flush privileges;
#授权root用户在客户端拥有数据库的访问权限
GRANT ALL PRIVILEGES ON *.* TO ‘hive‘@‘%‘ IDENTIFIED BY ‘hive‘ WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO ‘oozie‘@‘%‘ IDENTIFIED BY ‘oozie‘ WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO ‘amon‘@‘%‘ IDENTIFIED BY ‘amon‘ WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO ‘report‘@‘%‘ IDENTIFIED BY ‘report‘ WITH GRANT OPTION;
flush privileges;
2.9安装cm
cm和namenode复用了,机器太少了
1)将下载的cloudera-manager-centos7-cm5.7.2_x86_64.tar.gz上传至dcnn1目录/opt下(该目录为Cloudera manager的默认目录)
2)tar xvfz cloudera-manager*.tar.gz,解压后生成两个目录cloudera和cm-5.7.2
3)所有节点创建用户cloudera-scm
sudo useradd --system --home=/opt/cm-5.7.2/run/cloudera-scm-server/ --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
4)为Cloudera Manager 5建立数据库
首先需要去MySql的官网下载JDBC驱动mysql-connector-java-5.1.38.tar.gz(可以下载最新的版本),下载地址:http://dev.mysql.com/downloads/connector/j/ ,解压后找到mysql-connector-java-5.1.38-bin.jar放到/opt/cm-5.7.2/share/cmf/lib/中: cp mysql-connector-java-5.1.38-bin.jar /opt/cm-5.7.2/share/cmf/lib/
/opt/cm-5.7.2/share/cmf/schema/scm_prepare_database.sh mysql cm -h dcnn1 -uroot -pbigdata --scm-host dcnn1 scm scm scm
遇到问题:未解决,但不影响后面得部署
AVA_HOME=/usr/java/jdk1.8.0_60
Verifying that we can write to /opt/cm-5.7.2/etc/cloudera-scm-server
log4j:ERROR Could not find value for key log4j.appender.A
log4j:ERROR Could not instantiate appender named "A".
Creating SCM configuration file in /opt/cm-5.7.2/etc/cloudera-scm-server
Executing: /usr/java/jdk1.8.0_60/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/opt/cm-5.7.2/share/cmf/schema/../lib/* com.cloudera.enterprise.dbutil.DbCommandExecutor /opt/cm-5.7.2/etc/cloudera-scm-server/db.properties com.cloudera.cmf.db.
log4j:ERROR Could not find value for key log4j.appender.A
log4j:ERROR Could not instantiate appender named "A".
agent配置
1)修改/opt/cm-5.7.2/etc/cloudera-scm-agent/config.ini中的server_host, server_host为主节点的主机名
2)同步Agent到其他节点
sudo scp -r /opt/cm-5.7.2 [email protected]:/opt/;
sudo scp -r /opt/cm-5.7.2 [email protected]:/opt/;
sudo scp -r /opt/cm-5.7.2 [email protected]:/opt/;
sudo scp -r /opt/cm-5.7.2 [email protected]:/opt/;
2.10启动服务
通过sudo /opt/cm-5.7.2/etc/init.d/cloudera-scm-server start 启动服务端
通过sudo /opt/cm-5.7.2/etc/init.d/cloudera-scm-agent start 启动agent端
我们启动的其实是个service脚本,需要停止服务将以上的start参数改为stop就可以了,重启是restart。
2.11 通过cm部署CDH
1)登录http://10.20.20.1:7180
2)根据向导就可以一步一步进行了,比较简单。
3 遇到问题
1、hive和oozie启动失败
缺少JDBC驱动,因为我的mysql装在远端,这里要访问的时候要通过JDBC驱动。因此将mysql-connector-java-5.1.22-bin.jar添加到hive和oozie的lib:
sudo cp mysql-connector-java-5.1.38-bin.jar /opt/cloudera/parcels/CDH-5.7.2-1.cdh5.7.2.p0.18/lib/hive/lib
sudo cp mysql-connector-java-5.1.38-bin.jar /opt/cloudera/parcels/CDH-5.7.2-1.cdh5.7.2.p0.18/lib/oozie/libext
2、安装后hive在查询时失败,原因是权限问题
org.apache.hadoop.security.AccessControlException: Permission denied: user=bigdata, access=WRITE, inode="/user":hdfs:supergroup:drwxr-xr-x
最简单的处理办法是:服务范围勾选去掉。