Centos7搭建CDH5.15集群(完全版)

CDH是Cloudera的100%开源平台发行版,包括Apache Hadoop,专为满足企业需求而构建。CDH提供开箱即用的企业使用所需的一切。通过将Hadoop与十几个其他关键的开源项目集成,Cloudera创建了一个功能先进的系统,可帮助您执行端到端的大数据工作流程。
简单来说:CDH 是一个拥有集群自动化安装、中心化管理、集群监控、报警功能的一个工具(软件),使得集群的安装可以从几天的时间缩短为几个小时,运维人数也会从数十人降低到几个人,极大的提高了集群管理的效率。

一.节点说明

节点 Server/Agent Memory
master server & agent 4G
node1 agent 2G
node2 agent 2G

二.安装环境准备

因为网速问题,这次的安装的全部是以离线的安装包形式安装的。

1.基本环境构建

1.1网络配置和设置主机名

  1. 1.1 配置静态IP
[root@master network-scripts]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"     #此处改为none或static  设置为none禁止DHCP,设置为static启用静态IP地址,设置为dhcp开启DHCP服务
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="5c8028fa-a0b1-466e-bf7a-c0ecbd7e9fb1"
DEVICE="ens33"
ONBOOT="yes"                    #将此处改为yes,代表开机自启动网卡
IPADDR="192.168.5.135"          #本机静态IP地址     添加
PREFIX="24"                     #子网掩码24位
NETMASK=255.255.255.0           #子网掩码          添加
GATEWAY="192.168.5.2"           #网管             添加
DNS1="192.168.5.2"              #DNS解析          添加
IPV6_PRIVACY="no"

将有备注处进行修改或者添加,具体添加规则见:虚拟机环境搭建
此处有个疑问待解决:BOOTPROTO="" 设置为none禁止DHCP,设置为static启用静态IP地址,设置为dhcp开启DHCP服务(即动态IP),当设置为none和static时都能实现静态IP地址,但这2种设置的区别一直没找到资料,还有一些说法是none为无设置(可能是根据单词的字面意思理解的),如果是无设置,IP就会是可能是静态的或动态的,但什么情况是静态,什么情况是动态待解疑

  1. 1.2 设置主机名及IP对应
vi /etc/hostname      #更改本机名
vi /etc/hosts         #添加IP地址和主机名对应关系

hosts内容:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.5.135 master    #主节点对应
192.168.5.136 node1     #node1
192.168.5.137 node2     #node2

service network restart    #重启网卡

1.2 关闭防火墙

systemctl stop firewalld           #关闭防火墙
systemctl disable firewalld        #取消开机启动
firewall-cmd --state               #查看防火墙状态

1.3 关闭SELINUX

vi /etc/selinux/config      #修改config文件 SELINUX=disabled

*# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
*
sestatus -v      #查看状态

*SELinux status:                 disabled*     #代表SELinux已被关闭

1.4 安装JDK

  1. 4 .1查看已安装java的信息
rpm -qa | grep java
*tzdata-java-2018e-3.el7.noarch
java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64
python-javapackages-3.4.1-11.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.181-7.b13.el7.x86_64
javapackages-tools-3.4.1-11.el7.noarch
*
  1. 4 .2卸载自带open jdk
rpm -e --nodeps 包名
  1. 4 .3创建/usr/java目录,并上传jdk-8u221-linux-x64.rpm包到此目录下并解压
rpm -ivh jdk-8u221-linux-x64.rpm
  1. 4 .4配置环境变量
vi /etc/profile

export JAVA_HOME=/usr/java/jdk1.8.0_221-amd64
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/sbin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
  1. 4 .5让环境变量生效
source /etc/profile
  1. 4 .6查看Java状态
java -verison

2.克隆master节点环境,建立node1节点和node2节点

因为这是在笔记本电脑上虚拟机上创建的集群的,所以为了加快创建速度,采用复制通用环境建立其他2个节点,如你已经有独立的服务器节点,就可以在其他节点上执行上述操作。

3.完善基本环境

  1. 1 设置SSH免密登录(在所有节点执行)
1.产生公钥和私钥:ssh-keygen -t rsa (一直回车直即可)
2.将公钥分发给所有节点(包括本机):  ssh-copy-id -i 主机名
3.测试ssh访问:    ssh root@主机名
  1. 2设置NTP
yum -y install ntp    #更改master的节点
vi /etc/ntp.conf      #注释掉server 0.centos.pool.ntp.org iburst,在master节点新添加自己的ntp服务器,在其他2个节点将ntp服务器指向master节点

*# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server ntp4.aliyun.com iburst
*
systemctl start ntpd    #启动ntp服务
systemctl status ntpd   #查看ntp服务的状态
systemctl enabled ntpd   #设置ntp服务开机启动

如遇ntp服务开机启动不生效,请查看这篇博文解决:Centos7设置ntp服务开机自启动不生效的解决办法

4.安装mysql(只需在主节点安装)

  1. 卸载mariadb
rpm -qa|grep mariadb
rpm -e --nodeps mariadb的包名

Centos7搭建CDH5.15集群(完全版)_第1张图片

  1. 创建/opt/software目录
    将mysql安装包及mysql驱动jar包上传到/opt/software下
    安装包下载百度云盘:https://pan.baidu.com/s/1bKsx1sXdGngL0RMqVQqMJg
rz -bey

在这里插入图片描述

  1. 将mysql-5.7.27-linux-glibc2.12-x86_64.tar.gz解压到/usr/local目录下
    并更名为mysql-5.7
[root@master local]# tar -zxvf /opt/software/mysql-5.7.27-linux-glibc2.12-x86_64.tar.gz

[root@master local]# mv mysql-5.7.27-linux-glibc2.12-x86_64 mysql-5.7
  1. 配置my.cnf文件
    从mysql5.7开始不会自动生成my.cnf文件,需要我们手动创建
[root@master local]# vim /etc/my.cnf

配置文件内容如下:

[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
#跳过权限表校验
#skip-grant-tables
skip-name-resolve
#设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=/usr/local/mysql-5.7
# 设置mysql数据库的数据的存放目录
datadir=/usr/local/mysql-5.7/data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
lower_case_table_names=1
max_allowed_packet=16M

  1. 创建mysql数据存储目录
    在my.cnf文件中datadir参数,我们设置了datadir=/usr/local/mysql-5.7/data,但data目录并不存才,需要手动创建
[root@master local]# mkdir /usr/local/mysql-5.7/data
  1. 创建mysql用户,mysql组
[root@master mysql-5.7]# groupadd mysql
[root@master mysql-5.7]# useradd -r -g mysql mysql
[root@master mysql-5.7]# chown -R mysql:mysql /usr/local/mysql-5.7/
  1. 初始化mysql数据库,会输出初始密码注意记录root@localhost: XXXX
[root@master mysql-5.7]# cd bin
[root@master bin]# ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql-5.7 --datadir=/usr/local/mysql-5.7/data

如果没有及时记下密码,可修改/etc/my.cnf文件,在[mysqld]下方添加skip-grant-tables,意思是跳过权限表的校验,可以免密登录

  1. 启动mysql服务
[root@master mysql-5.7]# bin/mysqld_safe --user=mysql &
[3] 34358
[root@master mysql-5.7]# Logging to '/usr/local/mysql-5.7/data/master.err'.
2019-08-16T08:51:25.292028Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql-5.7/data

[root@master mysql-5.7]# service mysql start
Starting MySQL SUCCESS!
  1. 修改mysql的密码
    如果执行mysql -uroot -p提示**-bash: mysql: command not found**,是因为mysql没有添加到系统变量中,可通过软连接将mysql添加到系统的**/usr/bin**目录
[root@master mysql-5.7]# ln -s /usr/local/mysql-5.7/bin/mysql /usr/bin
[root@master mysql-5.7]# mysql -uroot -p
Enter password: 
mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> set password for 'root'@'localhost'=password('密码');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> exit;
Bye
[root@master mysql-5.7]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

因为无法使用use mysql 命令,所以
update mysql.user set authentication_string=password(‘密码’) where user=‘root’ and Host = ‘localhost’;
alter user ‘root’@‘localhost’ identified by ‘密码’;
无法用以上2条命名修改密码

  1. 添加数据库连接权限
mysql> update user set host='%' where user='root';    #允许所有ip的主机连接mysql数据库
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;   #授权远程主机允许连接mysql数据库
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;   #刷新MySQL的系统权限相关表­
Query OK, 0 rows affected (0.00 sec)
  1. 设置mysql服务开机自启动
[root@master mysql-5.7]# chkconfig --add mysql
[root@master mysql-5.7]# chkconfig mysql on

三.安装Cloudera Manager Server&Agent

1.安装Cloudera Manager Server&Agent

  1. 1.1上传安装包到/opt/software目录下,并安装到/opt目下
    Cloudera Manager Server&Agent软件包资源百度网盘地址:https://pan.baidu.com/s/1NGAGuf8bTizj8YTx0JRs8w
[root@master software]# ls
CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel          manifest.json
CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel.sha1     mysql-5.7.27-linux-glibc2.12-x86_64.tar.gz
cloudera-manager-centos7-cm5.15.0_x86_64.tar.gz  mysql-connector-java-5.1.48.jar

三个节点全部安装

[root@master opt]# tar -xvzf /opt/software/cloudera-manager-centos7-cm5.15.0_x86_64.tar.gz
[root@master opt]# ls
cloudera  cm-5.15.0  rh  software
  1. 1.2配置CM Agent
    1.cm的安装包的server和agent都是同一个包,启动的时候启动命令指定为server还是agent;
    2.cm有一个工作目录,需要我们来创建;创建一个用户;修改agent的配置,给它指定server的位置;那个端口7182是server和agent通信的端口;
    3.server_host配置为server的名字;
    vi /opt/cm-5.15.0/etc/cloudera-scm-agent/config.ini 中 server_host(三个节点均需设置)
[General]
# Hostname of the CM server.
server_host=master

# Port that the CM server is listening on.
server_port=7182

## It should not normally be necessary to modify these.
# Port that the CM agent should listen on.
# listening_port=9000

# IP Address that the CM agent should listen on.
# listening_ip=

# Hostname that the CM agent reports as its hostname. If unset, will be
# obtained in code through something like this:
#
#   python -c 'import socket; \
#              print socket.getfqdn(), \
#                    socket.gethostbyname(socket.getfqdn())'
#
# listening_hostname=

# An alternate hostname to report as the hostname for this host in CM.
# Useful when this agent is behind a load balancer or proxy and all
# inbound communication must connect through that proxy.
# reported_hostname=

# Port that supervisord should listen on.
# NB: This only takes effect if supervisord is restarted.
# supervisord_port=19001

# Log file.  The supervisord log file will be placed into
# the same directory.  Note that if the agent is being started via the

在config.ini文件设置server_host=主节点名字或IP

  1. 1.3 创建用户cloudera-scm(所有节点
useradd --system --home=/opt/cm-5.15.0/run/cloudera-scm-server/ --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
  1. 1.4创建Parcel目录

创建parcel目录,这个目录是server和agent用来接收和发送数据的目录,server端的parcel-repo这个目录会把所有的安装文件全部下载到此目录,而agent也需要安装包,parcels就是用来存储指定的安装包的,当然需要有权限能操作这些目录;
Server节点

[root@master opt]# mkdir -p /opt/cloudera/parcel-repo
[root@master opt]# chown cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo

Agent节点

[root@master opt]# mkdir -p /opt/cloudera/parcels
[root@master opt]# chown cloudera-scm:cloudera-scm /opt/cloudera/parcels

== 注意:这儿我们master节点既是server也是agent,所以master节点也创建parcels==

把CDH安装包移到cloudera/parcel-repo下面,并修改其中后缀为sha1的文件为sha,如下

[root@master software]# cp CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel  /opt/cloudera/parcel-repo/
[root@master software]# cp CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel.sha1  /opt/cloudera/parcel-repo/
[root@master software]# cp manifest.json  /opt/cloudera/parcel-repo/
[root@master software]# cd /opt/cloudera/parcel-repo/
[root@master parcel-repo]# ls
CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel  CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel.sha1  manifest.json
[root@master parcel-repo]# mv CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel.sha1  CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel.sha
[root@master parcel-repo]# ls
CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel  CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel.sha  manifest.json

  1. 1.5.配置CM Server的数据库
    将mysql数据库的驱动jar包放到/opt/cm-5.15.0/share/cmf/lib/目录下
[root@master software]# ls
CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel          manifest.json
CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel.sha1     mysql-5.7.27-linux-glibc2.12-x86_64.tar.gz
cloudera-manager-centos7-cm5.15.0_x86_64.tar.gz  mysql-connector-java-5.1.48.jar
[root@master software]# mv mysql-connector-java-5.1.48.jar mysql-connector-java.jar
[root@master software]# ls
CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel          manifest.json
CDH-5.15.0-1.cdh5.15.0.p0.21-el7.parcel.sha1     mysql-5.7.27-linux-glibc2.12-x86_64.tar.gz
cloudera-manager-centos7-cm5.15.0_x86_64.tar.gz  mysql-connector-java.jar
[root@master software]# cp mysql-connector-java.jar /opt/cm-5.15.0/share/cmf/lib/

初始化cm数据库

[root@master lib]# cd /opt/cm-5.15.0/share/cmf/schema/
[root@master schema]# ./scm_prepare_database.sh mysql cm -h master -uroot -p密码 --scm-host master root 密码 scm

初始化语句的格式:数据库类型、数据库、数据库服务器、用户名、密码、cm server服务器、用户名、密码、

创建其他组件需要的数据库

mysql> create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)

mysql> create database oozie DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)

mysql> create database hue DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)

  1. 1.6启动CM Manager&Agent服务
    注意:启用CM服务时要确保mysql启动
    Server节点执行
[root@master schema]#  /opt/cm-5.15.0/etc/init.d/cloudera-scm-server start
Starting cloudera-scm-server:                              [  确定  ]

Agent节点执行(master,node1,node2)

[root@master schema]# /opt/cm-5.15.0/etc/init.d/cloudera-scm-agent start 
Starting cloudera-scm-agent:                               [  确定  ]

查看7180端口是否被占用

[root@master schema]# netstat -apn|grep 7180
tcp        0      0 0.0.0.0:7180            0.0.0.0:*               LISTEN      26624/java

当端口已被占用,就可以用http://Server节点IP:7180打开登录页面,用户名和密码都是admin

四.安装CDH5

登录网页
Centos7搭建CDH5.15集群(完全版)_第2张图片Centos7搭建CDH5.15集群(完全版)_第3张图片选择免费版本,继续
Centos7搭建CDH5.15集群(完全版)_第4张图片继续,下一步,直到如下界面,可以在当前管理的主机列表中看到对应的节点。选择要安装的节点,这里选择全部节点,继续。
Centos7搭建CDH5.15集群(完全版)_第5张图片选择要下载安装的CDH版本
Centos7搭建CDH5.15集群(完全版)_第6张图片进行集群的安装,这个过程可能需要几分钟
Centos7搭建CDH5.15集群(完全版)_第7张图片
检查主机的正确性
Centos7搭建CDH5.15集群(完全版)_第8张图片此时出现的2个错误,我们根据提示解决一下,
更改交换空间:
执行 echo 10 > /proc/sys/vm/swappiness
并编辑/etc/sysctl.conf
将echo 10 > /proc/sys/vm/swappiness 加入到文件中,一遍重启时生效

[root@master etc]# vim sysctl.conf
[root@master etc]# echo 10 > /proc/sys/vm/swappiness

Centos7搭建CDH5.15集群(完全版)_第9张图片

如下禁用此设置,然后将同一命令添加到 /etc/rc.local 等初始化脚本中,以便在系统重启时予以设置。以下主机将受到影响:
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
先执行上面2条命令,再将其添加到/etc/rc.local文件中

[root@master etc]# echo never > /sys/kernel/mm/transparent_hugepage/defrag
[root@master etc]# echo never > /sys/kernel/mm/transparent_hugepage/enabled
[root@master etc]# vi rc.local

Centos7搭建CDH5.15集群(完全版)_第10张图片再次检查主机的正确性
Centos7搭建CDH5.15集群(完全版)_第11张图片选择需要安装的组件,因为内存有限,这儿选择核心组件就OK
Centos7搭建CDH5.15集群(完全版)_第12张图片选择各组件安装的节点,一般保持默认就OK
Centos7搭建CDH5.15集群(完全版)_第13张图片检查各个组件的数据库
Centos7搭建CDH5.15集群(完全版)_第14张图片Hue数据库检查出现错误

[root@master cloudera-scm-server]# tail -f /opt/cm-5.15.0/log/cloudera-scm-server/cloudera-scm-server.log

执行上面的命令后,再次检查各组件数据库,就可以看见具体的报错log,如下:

+ HUE=/opt/cloudera/parcels/CDH-5.15.0-1.cdh5.15.0.p0.21/lib/hue/build/env/bin/hue
+ [[ is_db_alive == runcpserver ]]
+ [[ is_db_alive == kt_renewer ]]
+ '[' dumpdata = is_db_alive ']'
+ '[' syncdb = is_db_alive ']'
+ '[' ldaptest = is_db_alive ']'
+ exec /opt/cloudera/parcels/CDH-5.15.0-1.cdh5.15.0.p0.21/lib/hue/build/env/bin/hue is_db_alive
[19/Aug/2019 17:16:28 +0000] settings     DEBUG    DESKTOP_DB_TEST_NAME SET: /opt/cloudera/parcels/CDH-5.15.0-1.cdh5.15.0.p0.21/lib/hue/desktop/desktop-test.db
[19/Aug/2019 17:16:28 +0000] settings     DEBUG    DESKTOP_DB_TEST_USER SET: hue_test
Traceback (most recent call last):
  File "/opt/cloudera/parcels/CDH-5.15.0-1.cdh5.15.0.p0.21/lib/hue/build/env/bin/hue", line 12, in 
    load_entry_point('desktop==3.9.0', 'console_scripts', 'hue')()
  File "/opt/cloudera/parcels/CDH-5.15.0-1.cdh5.15.0.p0.21/lib/hue/desktop/core/src/desktop/manage_entry.py", line 149, in entry
    raise e
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: libmysqlclient.so.18: cannot open shared object file: No such file or directory

大概的意思就是找不到libmysqlclient.so.18这个文件,
现在master服务器上查找下这个文件

[root@master cloudera-scm-server]# find / -name libmysqlclient.so.18
[root@master cloudera-scm-server]# 

查了一下资料这个文件是Centos7原来的mysql数据库中的文件,那我们在安装新的mysql的时候删除掉了,不过其他2个节点应该会有,查一下:

[root@node1 ~]# find / -name libmysqlclient.so.18
/usr/lib64/mysql/libmysqlclient.so.18

果然有,将这文件发送到master节点的mysql安装目录下,做软连接到/usr/lib64/libmysqlclient.so.18

[root@node1 ~]# scp /usr/lib64/mysql/libmysqlclient.so.18 root@master:/usr/local/mysql-5.7/lib/
libmysqlclient.so.18                                                                                              100% 3062KB  19.9M
[root@master lib64]# ln -s /usr/local/mysql-5.7/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18

然后在做组件数据库检查
Centos7搭建CDH5.15集群(完全版)_第15张图片OK问题解决,继续下一步,群集设置可以根据自己的需求更改,也可以保持默认
Centos7搭建CDH5.15集群(完全版)_第16张图片
第一次启动各个组件,hive在启动中报错,
Centos7搭建CDH5.15集群(完全版)_第17张图片查看详细日志,本地驱动失败,缺少驱动jar包
Centos7搭建CDH5.15集群(完全版)_第18张图片复制一份mysql-connector-java.jar到/opt/cloudera/parcels/CDH-5.15.0-1.cdh5.15.0.p0.21/lib/hive/lib/目录下

[root@master lib]# cp /opt/software/mysql-connector-java.jar  /opt/cloudera/parcels/CDH-5.15.0-1.cdh5.15.0.p0.21/lib/hive/lib/

Resume,重新启动,Oozie又报错,继续看日志,原因数据库连接不上
Centos7搭建CDH5.15集群(完全版)_第19张图片Centos7搭建CDH5.15集群(完全版)_第20张图片

按图日志操作,继续上面的处理办法复制驱动包

[root@master lib]# cp /opt/software/mysql-connector-java.jar  /opt/cloudera/parcels/CDH-5.15.0-1.cdh5.15.0.p0.21/lib/oozie/lib/
[root@master /]# cp /opt/software/mysql-connector-java.jar  /var/lib/oozie

再次Resume,中间Oozie又报了一次错,但我什么都没改,再次启动后竟然成功了,有时真的会抽风,多试几次可能就会成功
Centos7搭建CDH5.15集群(完全版)_第21张图片Centos7搭建CDH5.15集群(完全版)_第22张图片Centos7搭建CDH5.15集群(完全版)_第23张图片成功,至于上面的运行状态问题多半是,内存不足造成的,条件有限暂时就这样吧,算是整个过程搭建完毕。

五.设置Cloudera Manager Server&Agent开机自启动

Server配置master节点

[root@master ~]# cp /opt/cm-5.15.0/etc/init.d/cloudera-scm-server  /etc/init.d/cloudera-scm-server
[root@master ~]# chkconfig --add cloudera-scm-server
[root@master ~]# chkconfig cloudera-scm-server on
[root@master ~]# vi /etc/init.d/cloudera-scm-server  
//   CMF_DEFAULTS=${CMF_DEFAULTS:-/etc/default} 修改为 CMF_DEFAULTS=${CMF_DEFAULTS:-/opt/cm-5.15.0/etc/default}  #cloudera manager安装目录,然后保存退出即可。
//   添加:export JAVA_HOME=/usr/java/jdk1.8.0_221-amd64           #java安装目录
[root@master ~]# chkconfig --list cloudera-scm-server

注:该输出结果只显示 SysV 服务,并不包含
原生 systemd 服务。SysV 配置数据
可能被原生 systemd 配置覆盖。 

      要列出 systemd 服务,请执行 'systemctl list-unit-files'。
      查看在具体 target 启用的服务请执行
      'systemctl list-dependencies [target]'。

cloudera-scm-server	0:关	1:关	2:开	3:开	4:开	5:开	6:关     // 2-5为开时表示配置成功
[root@master ~]# service cloudera-scm-server start & systemctl start cloudera-scm-server.service
[1] 21442
Warning: cloudera-scm-server.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Starting cloudera-scm-server (via systemctl):  Warning: cloudera-scm-server.service changed on disk. Run 'systemctl daemon-reload' to reload units.
                                                           [  确定  ]
[1]+  完成                  service cloudera-scm-server start

Agent配置所有节点

[root@master ~]# cp /opt/cm-5.15.0/etc/init.d/cloudera-scm-agent /etc/init.d/cloudera-scm-agent
[root@master ~]# chkconfig --add cloudera-scm-agent
[root@master ~]# chkconfig cloudera-scm-agent on
[root@master ~]# vi /etc/init.d/cloudera-scm-agent
//   CMF_DEFAULTS=${CMF_DEFAULTS:-/etc/default} 修改为 CMF_DEFAULTS=${CMF_DEFAULTS:-/opt/cm-5.15.0/etc/default}  #cloudera manager安装目录,然后保存退出即可。
//   添加:export JAVA_HOME=/usr/java/jdk1.8.0_221-amd64           #java安装目录
[root@master ~]# service cloudera-scm-agent & systemctl start cloudera-scm-agent.service
[1] 22483
Warning: cloudera-scm-agent.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Job for cloudera-scm-agent.service failed because the control process exited with error code. See "systemctl status cloudera-scm-agent.service" and "journalctl -xe" for details.
[root@master ~]# Usage: cloudera-scm-agent {start|stop|restart|next_stop_hard|next_start_clean|status|condrestart}

[1]+  退出 3                service cloudera-scm-agent

六.安装失败后重新安装

  1. 删除Agent节点的UUID
rm -rf /var/lib/cloudera-scm-agent/cm_guid
  1. 清空主节点CM数据库
进入主节点的Mysql数据库,然后drop database cm;
  1. 删除Agent节点namenode和datanode节点信息
 rm -rf /opt/dfs/nn/*
 rm -rf /opt/dfs/dn/*
  1. 在主节点上重新初始化CM数据库
 /usr/share/cmf/schema/scm_prepare_database.sh mysql -uroot -proot scm scm scm
  1. 执行启动脚本
service cloudera-scm-server start     //Server节点
service cloudera-scm-agent start      //Agent节点

你可能感兴趣的:(大数据,CDH)