==========================部署规划开始==============================
server.com
mysql、server、namenode、agent、resourcemanager、journalnode、zookeeper、master、flume、master
agent01.com
secondarynamenode、datanode、agent、nodemanager、namenode、journalnode、zookeeper、regionserver、flume、worker、historyserer
agent02.com
datanode、agent、nodemanager、journalnode、zookeeper、resourcemanager、metastore、regionserver、flume、worker
agent03.com
datanode、agent、nodemanager、journalnode、zookeeper、master、regionserver、flume、sqoop2、worker
agent04.com
datanode、agent、nodemanager、jobhistoryserver、journalnode、zookeeper、hiveserver2、master、regionserver、flume、worker
部署的官方文档:
https://www.cloudera.com/documentation/enterprise/5-10-x/topics/cm_ig_install_path_c.html#
==========================数据库安装开始==============================
一、安装mysql数据库
1)选择服务器安装:server.com
2)检查服务器自带的mysql相关安装包
[root@server ~]# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.x86_64
[root@server ~]# rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64
3)使用yum方式安装mysql
yum -y install mysql-server
4)启动mysql: service mysqld start
5)设置登录密码:mysqladmin -u root password '123456'
6)设置开机自启:chkconfig mysqld on
进入msyql:mysql -u root -p123456
==========================CM安装开始==============================
二、CM的安装
1)安装第三方依赖(在所有服务器上)(可以看下官网上给的依赖 Install Package Dependencies)
yum -y install chkconfig python bind-utils psmisc libxslt zlib sqlite cyrus-sasl-plain cyrus-sasl-gssapi fuse portmap fuse-libs redhat-lsb
2)下载上传
//CM的下载地址:
http://archive.cloudera.com/cm5/cm/5/
//已有直接上传即可
上传到/opt/softwares文件夹下
3)安装
//先在server主节点上创建一个CM的解压目录
# mkdir -p /opt/cloudera-manager
# tar -zxf /opt/softwares/cloudera-manager-el6-cm5.10.2_x86_64.tar.gz -C /opt/cloudera-manager
//在解压路径下 两个子目录cloudera cm-5.10.2
//opt/cloudera-manager/cm-5.10.2 CM框架本身的配置、依赖库、启动脚本等文件)
4)在server主节点上修改agent配置
# vi /opt/cloudera-manager/cm-5.10.2/etc/cloudera-scm-agent/config.ini
# Hostname of the CM server.
server_host=server.com //指定server主节点
# Port that the CM server is listening on.
server_port=7182 //确认通信端口
5)拷贝CM解压后的包给其他服务器(其他服务器都发送)
# scp -r /opt/cloudera-manager/ agent01.com:/opt/
# scp -r /opt/cloudera-manager/ agent02.com:/opt/
6)创建cloudera Manager 专门用户 cloudera-scm(在agnet所有服务器节点)
# useradd --system --home=/opt/cloudera-manager/cm-5.10.2/run/cloudera-scm-server --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
详解: useradd
--system 表示创建的是系统用户
--home=/opt/cloudera-manager/cm-5.10.2/run/cloudera-scm-server 指定用户主目录路径
--no-create-home 不创建用户主目录
--shell=/bin/false 不作为一个登陆用户
--comment "Cloudera SCM User"
cloudera-scm 用户名
验证:
# cat /etc/passwd | grep cloudera-scm
7)配置CM数据库的权限
//登陆主节点msyql,
# mysql -uroot -p123456
//添加一个temp用户并属于相关权限(主节点,也即mysql安装的机器)
mysql> grant all privileges on *.* to 'temp'@'%' identified by 'temp' with grant option ;
mysql> grant all privileges on *.* to 'temp'@'server.com' identified by 'temp' with grant option;
mysql> grant all privileges on *.* to 'temp'@'agent01.com' identified by 'temp' with grant option;
mysql> grant all privileges on *.* to 'temp'@'agent02.com' identified by 'temp' with grant option;
mysql> grant all privileges on *.* to 'temp'@'agent03.com' identified by 'temp' with grant option;
mysql> grant all privileges on *.* to 'temp'@'agent04.com' identified by 'temp' with grant option;
mysql> flush privileges ;
//在主节点上
# cd /opt/cloudera-manager/cm-5.10.2/share/cmf/schema
//目录下scm_prepare_database.sh执行脚本文件命令
# ./scm_prepare_database.sh mysql -h server.com -utemp -ptemp --scm-host server.com scm scm scm
-》初始化mysql
scm: 用户
scm:密码
scm:数据库
//出现异常:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
//解决办法:在所有服务器上的/usr/share/java目录放入 mysql的驱动jar包,并且要求将jar包名称改为“mysql-connector-java.jar”
cp /opt/softwares/mysql-connector-java.jar /usr/share/java
//成功显示:
All done, your SCM database is configured correctly!
8)将CDH源放到cloudera Manager 主节点服务器上
下载地址:http://archive.cloudera.com/cdh5/parcels/
CDH源:hadoop集群(hadoop、flume、hbase等等)的安装文件
//在server主节点上创建,注意:目录名称不能变
# mkdir -p /opt/cloudera/parcel-repo
//在agent主机节点上创建
# mkdir -p /opt/cloudera/parcels
//移动CDH源到parcel-repo目录下
# mv CDH-5.10.2-1.cdh5.10.2.p0.5-el6.parcel* /opt/cloudera/parcel-repo/
//移动CDH源,去掉校验码文件结尾的1
# mv CDH-5.10.2-1.cdh5.10.2.p0.5-el6.parcel.sha1 CDH-5.10.2-1.cdh5.10.2.p0.5-el6.parcel.sha
//更改parcel目录的所有人
//server节点
# chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo/
//agent节点(所有agent节点)
# chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcels
9)启动CM进程
server进程:
//CM的进程启动脚本目录
# cd /opt/cloudera-manager/cm-5.10.2/etc/init.d
//启动命令,注意:至少需要8G内存
# ./cloudera-scm-server start
//server主进程的log日志目录
# cd /opt/cloudera-manager/cm-5.10.2/log/cloudera-scm-server
# tail -f cloudera-scm-server.log
//CM控制台(等待5分钟)
agent从节点进程(在所有agent节点中启动):
# cd /opt/cloudera-manager/cm-5.10.2/etc/init.d/
# ./cloudera-scm-agent start
//看不到agent进程,因为是Python语言维护
CM的jetty服务器操作界面的访问端口 7180
http://server.com:7180 //操作界面
//启动好后 ,netstat -tlnup | grep 7180 查看是否正常开启了7180页面访问端口
//通过浏览器访问
http://server.com:7180
登录 admin admin
================================================================================================
三、检测主机时会出现的异常警告
10)检查主机的正确性
异常:
1.Cloudera 建议将 /proc/sys/vm/swappiness 设置为最大值 10。当前设置为 60。
//当前设置查看
# more /proc/sys/vm/swappiness
//三台agent主机都执行(不适用磁盘作为内存交换区)
# echo 10 > /proc/sys/vm/swappiness
2.已启用透明大页面压缩,可能会导致重大性能问题。请运行“echo never > /sys/kernel/mm/transparent_hugepage/defrag”和“echo never > /sys/kernel/mm/transparent_hugepage/enabled”以禁用此设置,然后将同一命令添加到 /etc/rc.local 等初始化脚本中,以便在系统重启时予以设置。以下主机将受到影响::
(所有机器执行:)
# echo never > /sys/kernel/mm/transparent_hugepage/defrag
# echo never > /sys/kernel/mm/transparent_hugepage/enabled
# vi /etc/rc.local //添加上面的echo命令