172.16.0.147 server(主节点)/agent
mysql、namenode、resource manager、master、zookeeper、hiveserver、flume、SecondaryNamenode
172.16.0.115 agent (从节点)
datanode、nodemanager、regionserver、zookeeper、namenode(热备)、hiveserver、flume
172.16.0.124 agent (从节点)
datanode、nodemanager、regionserver、zookeeper 、resource manager(热备)、hiveserver、flume
1.在第一台hadoop上安装mysql数据库
2.安装步骤参考之前的blog:
阿里云搭建大数据平台(6):Hive和mysql安装和配置,连接:https://blog.csdn.net/u010886217/article/details/83690267
1.安装第三方依赖(在所有服务器上)
yum -y install chkconfig python bind-utils psmisc libxslt zlib sqlite cyrus-sasl-plain cyrus-sasl-gssapi fuse portmap fuse-libs redhat-lsb
2.下载上传对应版本cloudera-manager
下载地址http://archive.cloudera.com/cm5/cm/5/
因为系统是centos7,所以下载的是cloudera-manager-centos7-cm5.10.2_x86_64.tar.gz
注意:版本很重要,一定要与系统对应,否则启动会出现问题
3.安装
先在server主节点上创建一个CM的解压目录
mkdir -p /opt/cloudera-manager
tar -zxvf /opt/software/cloudera-manager-centos7-cm5.10.2_x86_64.tar.gz -C /opt/cloudera-manager/
4.在server主节点上修改agent配置【hadoop上】
vi /opt/cloudera-manager/cm-5.10.2/etc/cloudera-scm-agent/config.ini
# Hostname of the CM server.
server_host=hadoop //指定server主节点
# Port that the CM server is listening on.
server_port=7182 //确认通信端口
5.拷贝CM解压后的包给其他服务器
scp -r /opt/cloudera-manager/ hadoop02:/opt/
scp -r /opt/cloudera-manager/ hadoop03:/opt/
6.创建cloudera Manager 专门用户
(1)第1-3台都需要
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
详解:
--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 用户名
(2)验证
[root@hadoop cloudera-manager]# cat /etc/passwd | grep cloudera-scm
cloudera-scm:x:997:995:Cloudera SCM User:/opt/cloudera-manager/cm-5.10.2/run/cloudera-scm-server:/bin/false
7.配置CM数据库的权限
(1)登陆主节点msyql
第一台hadoop
mysql -uroot -p123456
(2)给所有用户授权
mysql> grant all privileges on *.* to 'cm'@'%' identified by 'cm' with grant option ;
mysql> grant all privileges on *.* to 'cm'@'hadoop' identified by 'cm' with grant option;
mysql> flush privileges ;
检查
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select user,host from user;
+--------+-----------+
| user | host |
+--------+-----------+
| cm | % |
| mysqld | % |
| root | % |
| cm | hadoop |
| hue | localhost |
+--------+-----------+
5 rows in set (0.00 sec)
(3)安装mysql驱动jar包到指定位置,否则(4)会报错
cp mysql-connector-java-5.1.27-bin.jar /usr/share/java
mv mysql-connector-java-5.1.27-bin.jar mysql-connector-java.jar
(4)初始化cm元数据信息
//在主节点上
# cd /opt/cloudera-manager/cm-5.10.2/share/cmf/schema
//目录下scm_prepare_database.sh执行脚本文件命令
# ./scm_prepare_database.sh mysql -h hadoop -ucm -pcm --scm-host hadoop scm scm scm
解释:
初始化mysql数据库
scm:用户
scm:密码
scm:数据库
8.将CDH源放到cloudera Manager 主节点服务器上
(1)下载cm源,下载指定版本
http://archive.cloudera.com/cdh5/parcels/
(2)创建指定目录
//在server主节点上创建,注意:目录名称不能变【第一台】
# mkdir -p /opt/cloudera/parcel-repo
//在agent主机节点上创建【第一二三台】
# mkdir -p /opt/cloudera/parcels
(3)上传源文件到
mv /opt/software/CDH-5.10.2-1.cdh5.10.2.p0.5-el7.parcel* /opt/cloudera/parcel-repo/
(4)移动CDH源,去掉校验码文件结尾的1
mv CDH-5.10.2-1.cdh5.10.2.p0.5-el7.parcel.sha1 CDH-5.10.2-1.cdh5.10.2.p0.5-el7.parcel.sha
(5)更改parcel目录的所有人
//server节点【第1台】
# chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo/
//agent节点(所有agent节点)【第1,2,3台】
# chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcels
9.启动CM进程
(1)启动server主节点
(1)//CM的进程启动脚本目录
# cd /opt/cloudera-manager/cm-5.10.2/etc/init.d
(2)//启动命令,注意:至少需要8G内存
# ./cloudera-scm-server start
结果:
[root@hadoop init.d]# ./cloudera-scm-server start
Starting cloudera-scm-server: [ OK ]
(3)//server主进程的log日志目录
# cd /opt/cloudera-manager/cm-5.10.2/log/cloudera-scm-server
# tail -f cloudera-scm-server.log
//CM控制台(等待5分钟)【最好等待5min】
结果:
2018-12-27 23:05:42,908 INFO WebServerImpl:com.cloudera.server.web.cmf.AggregatorController: AggregateSummaryScheduler started.
2018-12-27 23:05:44,469 INFO WebServerImpl:org.mortbay.log: jetty-6.1.26.cloudera.4
2018-12-27 23:05:44,470 INFO WebServerImpl:org.mortbay.log: Started [email protected]:7180
2018-12-27 23:05:44,470 INFO WebServerImpl:com.cloudera.server.cmf.WebServerImpl: Started Jetty server.
(4)检查
jps
里面一个main就是server进程
结果:
[root@hadoop cloudera-scm-server]# jps
2469 Main
2551 Jps
1084 WrapperSimpleApp
(2)启动agent从节点
第1台
[root@hadoop init.d]# ./cloudera-scm-agent start
Starting cloudera-scm-agent: [ OK ]
第2台
[root@hadoop02 ~]# cd /opt/cloudera-manager/cm-5.10.2/etc/init.d/
[root@hadoop02 init.d]# ./cloudera-scm-agent start
Starting cloudera-scm-agent: [ OK
第3台
[root@hadoop03 ~]# cd /opt/cloudera-manager/cm-5.10.2/etc/init.d/
[root@hadoop03 init.d]# ./cloudera-scm-agent start
Starting cloudera-scm-agent: [ OK
(3)检查agent进程
ps -ef | grep agent
(4)windows映射
修改C:\Windows\System32\drivers\etc
使用公网ip hadoop
使用公网ip hadoop02
使用公网ip hadoop03
(5)windows访问界面
http://hadoop:7180
登陆 admin admin