赞
踩
序号 | IP地址 | 主机名 | 系统版本 | CDH版本 | 内存 | 处理器 | 硬盘 |
---|---|---|---|---|---|---|---|
1 | 192.168.6.104 | CDH01 | CentOS Linux release 7.2.1511 | 5.10.0 | 8G | 12 | 300G |
2 | 192.168.6.105 | CDH02 | CentOS Linux release 7.2.1511 | 5.10.0 | 8G | 12 | 300G |
3 | 192.168.6.106 | CDH03 | CentOS Linux release 7.2.1511 | 5.10.0 | 8G | 12 | 300G |
hostnamectl set-hostname CDH01 #在192.168.6.104机器上
hostnamectl set-hostname CDH02 #在192.168.6.105机器上
hostnamectl set-hostname CDH03 #在192.168.6.106机器上
编辑/etc/hosts
vim /etc/hosts
追加以下配置
192.168.6.104 CDH01
192.168.6.105 CDH02
192.168.6.106 CDH03
重启服务
service network restart
验证
hostname
1:查看防火状态
systemctl status firewalld
2:暂时关闭防火墙
systemctl stop firewalld
3:永久关闭防火墙
systemctl disable firewalld
4:重启防火墙
systemctl enable firewalld
1、清空~/.ssh目录
rm -rf ~/.ssh/*
mkdir ~/.ssh
cd ~/.ssh
2、分别在每台机器上生成私钥和公钥(三次回车)
ssh-keygen -t rsa
3、分别在每台机器上将公钥拷贝到要免密登录的目标机器上(注意每台机器都要运行一下代码)
ssh-copy-id CDH01
ssh-copy-id CDH02
ssh-copy-id CDH03
1、临时生效
setenforce 0
2、永久修改需重启
vim /etc/selinux/config
设置SELINUX=disabled
2.1拷贝文件到另外两台机器
scp /etc/selinux/config root@CDH02:/etc/selinux/config
scp /etc/selinux/config root@CDH03:/etc/selinux/config
reboot
创建用户
#删除原来的用户
drop user 'hive'@'%';
drop user 'hue'@'%';
drop user 'oozie'@'%';
drop user 'reports'@'%';
#创建用户
CREATE USER 'hive'@'%' IDENTIFIED BY 'root';
CREATE USER 'hue'@'%' IDENTIFIED BY 'root';
CREATE USER 'oozie'@'%' IDENTIFIED BY 'root';
CREATE USER 'reports'@'%' IDENTIFIED BY 'root';
创建数据库
CREATE DATABASE hive;
CREATE DATABASE hue;
CREATE DATABASE oozie;
CREATE DATABASE reports;
最后赋予各个用户权限
GRANT ALL ON hive.* TO 'hive'@'%' ;
GRANT ALL ON hue.* TO 'hue'@'%' ;
GRANT ALL ON oozie.* TO 'oozie'@'%' ;
GRANT ALL ON reports.* TO 'reports'@'%' ;
#刷新生效
flush privileges;
mkdir /opt/cloudera-manager
tar -zxvf /opt/soft/cloudera-manager-centos7-cm5.10.0_x86_64.tar.gz -C /opt/cloudera-manager
#删除用户
userdel -rf cloudera-scm
#创建用户
useradd --system --home=/opt/cloudera-manager/cm-5.10.0/run/cloudera-scm-server --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
mkdir /var/log/cloudera-scm-server
chown cloudera-scm:cloudera-scm /var/log/cloudera-scm-server
将server_host=localhost改为server_host=CDH01
vim /opt/cloudera-manager/cm-5.10.0/etc/cloudera-scm-agent/config.ini
mkdir -p /opt/cloudera/parcel-repo
chown cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo
mkdir -p /opt/cloudera/parcels
chown cloudera-scm:cloudera-scm /opt/cloudera/parcels
#如果有则不用创建
mkdir /opt/cloudera-manager/cm-5.10.0/run/cloudera-scm-agent
将mysql-connector-java-8.0.19.jar文件放到/opt/cm-5.10.0/share/cmf/lib/中
cp /opt/soft/mysql-connector-java-8.0.19.jar /opt/cloudera-manager/cm-5.10.0/share/cmf/lib/
/opt/cloudera-manager/cm-5.10.0/share/cmf/schema/scm_prepare_database.sh mysql cm -hlocalhost -uroot -proot --scm-host localhost scm scm scm
将CHD5相关的Parcel包放到/opt/cloudera/parcel-repo/
目录中
mkdir /opt/cloudera/parcel-repo/
cp /opt/soft/CDH-5.10.0-1.cdh5.10.0.p0.41-el7.parcel /opt/cloudera/parcel-repo/
cp /opt/soft/CDH-5.10.0-1.cdh5.10.0.p0.41-el7.parcel.sha1 /opt/cloudera/parcel-repo/
cp /opt/soft/manifest.json /opt/cloudera/parcel-repo/
mv /opt/cloudera/parcel-repo/CDH-5.10.0-1.cdh5.10.0.p0.41-el7.parcel.sha1 /opt/cloudera/parcel-repo/CDH-5.10.0-1.cdh5.10.0.p0.41-el7.parcel.sha
在CDH01节点启动服务端:
/opt/cloudera-manager/cm-5.10.0/etc/init.d/cloudera-scm-server start
在所有节点启动Agent:
/opt/cloudera-manager/cm-5.10.0/etc/init.d/cloudera-scm-agent start
分别使用查看状态
/opt/cloudera-manager/cm-5.10.0/etc/init.d/cloudera-scm-server status
/opt/cloudera-manager/cm-5.10.0/etc/init.d/cloudera-scm-agent status
检查server和agent状态。如果出错,比如死掉了之类的,去/opt/cloudera-manager/cm-5.10.0/log
里面查看日志,看看是哪里报错了,如果agent报错是以下这样:
[20/Aug/2020 17:59:51 +0000] 6905 MainThread agent INFO CM server guid: a40faaf6-ef1f-404d-8765-e9c6d22feded [20/Aug/2020 17:59:51 +0000] 6905 MainThread agent INFO Using parcels directory from server provided value: /opt/cloudera/parcels [20/Aug/2020 17:59:51 +0000] 6905 MainThread agent WARNING Expected user root for /opt/cloudera/parcels but was cloudera-scm [20/Aug/2020 17:59:51 +0000] 6905 MainThread agent WARNING Expected group root for /opt/cloudera/parcels but was cloudera-scm [20/Aug/2020 17:59:51 +0000] 6905 MainThread parcel INFO Agent does create users/groups and apply file permissions [20/Aug/2020 17:59:51 +0000] 6905 MainThread parcel_cache INFO Using /opt/cloudera/parcel-cache for parcel cache [20/Aug/2020 17:59:52 +0000] 6905 MainThread agent ERROR Caught unexpected exception in main loop. Traceback (most recent call last): File "/opt/cloudera-manager/cm-5.10.0/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.10.0-py2.7.egg/cmf/agent.py", line 710, in __issue_heartbeat self._init_after_first_heartbeat_response(resp_data) File "/opt/cloudera-manager/cm-5.10.0/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.10.0-py2.7.egg/cmf/agent.py", line 947, in _init_after_first_heartbeat_response self.client_configs.load() File "/opt/cloudera-manager/cm-5.10.0/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.10.0-py2.7.egg/cmf/client_configs.py", line 682, in load new_deployed.update(self._lookup_alternatives(fname)) File "/opt/cloudera-manager/cm-5.10.0/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.10.0-py2.7.egg/cmf/client_configs.py", line 432, in _lookup_alternatives return self._parse_alternatives(alt_name, out) File "/opt/cloudera-manager/cm-5.10.0/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.10.0-py2.7.egg/cmf/client_configs.py", line 444, in _parse_alternatives path, _, _, priority_str = line.rstrip().split(" ") ValueError: too many values to unpack [20/Aug/2020 17:59:56 +0000] 6905 MainThread agent INFO CM server guid: a40faaf6-ef1f-404d-8765-e9c6d22feded
编辑错误信息中的文件,加入以下三行代码
缩进
,一旦缩进不正确文件无法生效,服务无法启动,问题不能得到解决。vim /opt/cloudera-manager/cm-5.10.0/lib64/cmf/agent/build/env/lib/python2.7/site-packages/cmf-5.10.0-py2.7.egg/cmf/client_configs.py
if len(line.rstrip().split(" "))<=4:
else:
pass
注意:所有节点都要改这个配置文件
所有节点重启agent服务
/opt/cloudera-manager/cm-5.10.0/etc/init.d/cloudera-scm-agent restart
验证都正常工作后,就在浏览器打开http://CDH01:7180
或http://192.168.6.104:7180
进入CDH管理界面,由于CM Server的启动需要花点时间,这里可能要等待一会才能访问,默认的用户名和密码均为admin。
要能直接在当前管理的主机
能看到三台机子,分别为CDH01,CDH02,CDH03,才说明安装正确了,如果搜不到,说明可能是你偷懒直接复制cm-5.10.0
这个文件夹给其他主机了,因为在启动的时候会生成一个SSID
,是这个机子唯一的,所以搜索的时候可能会出问题。
这一步点选使用Parcel(建议)
,将网络地址全部删除,退出来后要能看到可以选择本地包才说明本地配置对了,如果没看到,可能有以下几个原因:
cloudera
,parcel-repo
和parcels
三个文件夹的权限设置没有设置好。如果出现在此页面不动的情况在hosts中添加
127.0.0.1 localhost
#然后刷新
service network restart
根据提示信息进行修改
所有节点
运行下面代码
echo 10 > /proc/sys/vm/swappiness
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /etc/rc.local
然后重启104,105,106
/opt/cloudera-manager/cm-5.10.0/etc/init.d/cloudera-scm-agent restart
提示:当仍然有警告,可先跳过去(集群搭建完再做调整)
注意将DataNode选成所有主机,还有下面的Zookeeper选成所有主机,其他默认就可以了。
如果出现以下信息
直接回到上一步,再回来设置一下就行。
出现以上情况就重新修改密码
update user set password=password("root") where user="hive";
update user set password=password("root") where user="hue";
update user set password=password("root") where user="oozie";
update user set password=password("root") where user="reports";
flush privileges;
默认就行
报错如下:
检查发现安装JDK之前未将原来的openjdk卸载,卸载之后刷新/etc/profile
文件查看JDK版本
source /etc/profile
java -version
依旧报错,还是去找原来的openjdk了,如下:
这里需要强调一下CDH5默认识别的jdk路径为:/usr/java/default
创建软链接去自己安装的jdk路径(所有节点都进行)
mkdir -p /usr/java/default/
ln -s /opt/module/jdk1.8.0_191 /usr/java/default
#删除软连接命令
rm -rf /usr/java/default
再次运行
把MySQL驱动拷贝到/usr/share/java/
下,并修改名称为mysql-connector-java.jar
所有节点都要进行
cp /opt/soft/mysql-connector-java-8.0.19.jar /usr/share/java/
mv /usr/share/java/mysql-connector-java-8.0.19.jar /usr/share/java/mysql-connector-java.jar
至此CDH大数据平台搭建完成!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。