CentOS 7下Cloudera Manager及CDH 5.14.0安装过程详解
一、环境:1.三台VMware虚拟机(一个做为主节点,两个做为从节点)hserver1n(主节点)hserver2n(从节点)hserver3n(从节点)CM ServerCM AgentCM AgentCM AgentNameNodeDateNodeDateNodeMysql2.操作系统:CentOS 73....
一、环境:
1.三台VMware虚拟机(一个做为主节点,两个做为从节点)
hserver1n(主节点) hserver2n(从节点) hserver3n(从节点)
CM Server
CM Agent CM Agent CM Agent
NameNode DateNode DateNode
Mysql
2.操作系统:CentOS 7
3.Cloudera Manager:5.14.1
4.CDH:5.14.0
5.JDK1.8
二、软件下载地址
1.Cloudera Manager
https://archive.cloudera.com/cm5/cm/5/cloudera-manager-centos7-cm5.14.1_x86_64.tar.gz
2.CDH
http://archive.cloudera.com/cdh5/parcels/5.14/
3.JDK和MySQL自行搜索
三、系统环境设置:
以下步骤都使用root用户操作
1.设置静态IP
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=“Ethernet”
BOOTPROTO=“static”
DEFROUTE=“yes”
PEERDNS=“yes”
PEERROUTES=“yes”
IPV4_FAILURE_FATAL=“no”
IPV6INIT=“yes”
IPV6_AUTOCONF=“yes”
IPV6_DEFROUTE=“yes”
IPV6_PEERDNS=“yes”
IPV6_PEERROUTES=“yes”
IPV6_FAILURE_FATAL=“no”
IPV6_ADDR_GEN_MODE=“stable-privacy”
NAME=“ens33”
UUID=“edcb54db-f59d-4893-bd8e-8ae60d0ba6f9”
DEVICE=“ens33”
ONBOOT=“yes”
GATEWAY=192.168.124.2
IPADDR=192.168.124.136
NETMASK=255.255.255.0
DNS1=202.96.128.86
DNS2=223.5.5.5
还需要设置虚拟网络:
(1) 点击虚拟网络编辑器
(2)子网,子网掩码,以及NAT设置
(3)虚拟机网络选择刚设置的VMnet8
(4)重启网络
[root@localhost ~]# systemctl restart network
安装JDK
首先卸载原有的openJDK
[root@hadoop1~]$ java -version
java version “1.7.0_75”
OpenJDK Runtime Environment (rhel-2.5.4.2.el7_0-x86_64 u75-b13)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)
[root@hadoop1~]$ rpm -qa | grep jdk
java-1.7.0-openjdk-1.7.0.75-2.5.4.2.el7_0.x86_64
java-1.7.0-openjdk-headless-1.7.0.75-2.5.4.2.el7_0.x86_64
[root@hadoop1~]# yum -y remove java-1.7.0-openjdk-1.7.0.75-2.5.4.2.el7_0.x86_64
[root@hadoop1~]# yum -y remove java-1.7.0-openjdk-headless-1.7.0.75-2.5.4.2.el7_0.x86_64
[root@hadoop1~]# java -version
bash: /usr/bin/java: No such file or directory
[root@hadoop1~]# rpm -ivh jdk-8u101-linux-x64.rpm
[root@hadoop1~]# java -version
java version “1.8.0_101”
Java™ SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot™ 64-Bit Server VM (build 25.101-b13, mixed mode)
修改每台节点服务器的有关配置hostname、selinux关闭,防火墙关闭
hostname修改:分别对三台都进行更改,并且注意每台名称和ip,每台都要配上hosts
[root@hadoop1~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=hadoop1
[root@hadoop1~]# vi /etc/hosts
127.0.0.1 localhost.hadoop1
192.168.160.132 hadoop3
192.168.160.130 hadoop1
192.168.160.131 hadoop2
selinux关闭(所有节点官方文档要求)
[root@hadoop1~]# vim /etc/sysconfig/selinux
SELINUX=disabled
重启才能生效
重启后检查
[root@hadoop1~]#sestatus -v
SELinux status: disabled
表示已经关闭了
关闭防火墙(注意centos 6 防火墙好像是iptables)
[root@hadoop1~]# systemctl stop firewalld
[root@hadoop1~]# systemctl disable firewalld
rm ‘/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service’
rm ‘/etc/systemd/system/basic.target.wants/firewalld.service’
[root@hadoop1~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
Active: inactive (dead)
NTP服务器设置(用于不同节点间实现时间同步)
NTP服务的安装和配置
[root@hadoop1~]#yum -y install ntp
更改master的节点
[root@hadoop1~]## vi /etc/ntp.conf
注释掉所有server ..*的指向,新添加一条可连接的ntp服务器(百度一下ntp服务器,我选的是上海交大的)
server ntp.sjtu.edu.cn iburst
在其他节点上把ntp指向master服务器地址即可(/etc/ntp.conf下)
server 192.168.160.130 iburst
所有节点
SSH无密码登录配置,安装过程中master需要各个节点的root免登录密码
先在master上生成公钥
[root@hadoop1]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): [enter]
Created directory ‘/root/.ssh’.
Enter passphrase (empty for no passphrase): [enter]
Enter same passphrase again: [enter]
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
1d:b1:99:51:31:d8:f6:6c:b1:84:f9:af:7b:2c:72:dd root@hadoop1
The key’s randomart image is:
±-[ RSA 2048]----+
| o+++ |
| .*=.o |
| =. = o |
| . . * |
| S . . . |
| .|
| +.|
| . + E|
| o.+ |
±----------------+
[root@hadoop1]# ssh-copy-id 192.168.160.131
The authenticity of host ‘192.168.160.131 (192.168.160.131)’ can’t be established.
ECDSA key fingerprint is e6:81:3f:9e:e6:bb:43:36:c7:4e:0f:6f:63:b2:12:a0.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed – if you are prompted now it is to install the new keys
root@192.168.160.131’s password:
Number of key(s) added: 1
Now try logging into the machine, with: “ssh ‘192.168.160.131’”
and check to make sure that only the key(s) you wanted were added.
四、安装MySQL
mysql只需在主节点安装
1、卸载系统自带的 mariadb-lib
[root@centos-linux ~]# rpm -qa|grep mariadb
mariadb-libs-5.5.44-2.el7.centos.x86_64 [root@centos-linux ~]#
rpm
-e mariadb-libs-5.5.44-2.el7.centos.x86_64 --nodeps
2、下载mysql5.7.16
rpm安装包,官网最新的mysql安装包是mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar下载地址
[root@centos-linux ~]# wget
http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar
然后解压 [root@linux_node_1 src]# tar -xvf
mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar
mysql-community-libs-compat-5.7.16-1.el7.x86_64.rpm
mysql-community-devel-5.7.16-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.16-1.el7.x86_64.rpm
mysql-community-libs-5.7.16-1.el7.x86_64.rpm
mysql-community-common-5.7.16-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.16-1.el7.x86_64.rpm
mysql-community-test-5.7.16-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.16-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.16-1.el7.x86_64.rpm
mysql-community-server-5.7.16-1.el7.x86_64.rpm
mysql-community-client-5.7.16-1.el7.x86_64.rpm
mysql-community-embedded-5.7.16-1.el7.x86_64.rpm
3、安装 依次执行(几个包有依赖关系,所以执行有先后)下面命令安装
[root@centos-linux ~]# rpm -ivh mysql-community-common-5.7.16-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-libs-5.7.16-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-client-5.7.16-1.el7.x86_64.rpm [root@centos-linux ~]# rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm
在安装rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm的时候报错如下: warning:
mysql-community-server-5.7.16-1.el7.x86_64.rpm: Header V3
DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed
dependencies: libaio.so.1()(64bit) is needed by
mysql-community-server-5.7.16-1.el7.x86_64
libaio.so.1(LIBAIO_0.1)(64bit) is needed by
mysql-community-server-5.7.16-1.el7.x86_64
libaio.so.1(LIBAIO_0.4)(64bit) is needed by
mysql-community-server-5.7.16-1.el7.x86_64 net-tools is needed
by mysql-community-server-5.7.16-1.el7.x86_64
这个报错的意思是需要安装libaio包和net-tools包:可以yum安装一下,安装 libaio-0.3.107-10.el6.x86_64.rpm,下载地址:
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpm
然后yum安装net-tools yum install net-tools 完成之后就可以顺利安装 4、数据库初始化
为了保证数据库目录为与文件的所有者为 mysql 登陆用户,如果你是以 root 身份运行 mysql
服务,需要执行下面的命令初始化 mysqld --initialize --user=mysql 如果是以 mysql 身份运行,则可以去掉 --user 选项。
另外 --initialize 选项默认以“安全”模式来初始化,则会为 root 用户生成一个密码并将该密码标记为过期,登陆后你需要设置一个新的密码,而使用 --initialize-insecure 命令则不使用安全模式,则不会为 root 用户生成一个密码。
这里演示使用的 --initialize 初始化的,会生成一个 root
账户密码,密码在log文件里,红色区域的就是自动生成的密码
[root@linux_node_1 src]# cat /var/log/mysqld.log
2016-12-07T04:41:58.028558Z 0 [Warning] TIMESTAMP with implicit
DEFAULT value is deprecated. Please use
–explicit_defaults_for_timestamp server option (see documentation for more details). 2016-12-07T04:41:58.315188Z 0
[Warning] InnoDB: New log files created, LSN=45790
2016-12-07T04:41:58.355114Z 0 [Warning] InnoDB: Creating foreign
key constraint system tables. 2016-12-07T04:41:58.418448Z 0
[Warning] No existing UUID has been found, so we assume that this
is the first time that this server has been started. Generating a
new UUID: 7cc98831-bc37-11e6-a263-000c29f902dc.
2016-12-07T04:41:58.419935Z 0 [Warning] Gtid table is not ready
to be used. Table ‘mysql.gtid_executed’ cannot be opened.
2016-12-07T04:41:58.420558Z 1 [Note] A temporary password is
generated for root@localhost: )1r3gi,hjgQa
现在启动mysql数据库systemctl start mysqld.service
[root@linux_node_1 src]# systemctl start mysqld.service
[root@linux_node_1 src]# mysql -uroot -p
Enter password: Welcome to the MySQL monitor. Commands end
with ; or \g. Your MySQL connection id is 2 Server version:5.7.16
Copyright © 2000, 2016, 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.
mysql>
5、修改密码
更改密码策略:
set global validate_password_policy=0;
判断密码的标准就基于密码的长度了
该密码被标记为过期了,如果想正常使用还需要修改密码
mysql> show databases; ERROR 1820 (HY000): You must reset your
password using ALTER USER statement before executing this
statement.
以前的 password()函数将会被抛弃,官方建议使用下面的命令来修改密码
mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘new_password’;
同时,如果你设置的密码过于简单也会报错。
五、安装Clouder Manager及CDH
所有节点操作:
1.新建目录
$ sudo mkdir /opt/cloudera-manager
2.将下载的Clouder Manager解压到此目录下
$ sudo tar xzf cloudera-manager*.tar.gz -C /opt/cloudera-manager
3.创建用户cloudera-scm
由于Cloudera Manager和Managed Services默认使用cloudera-scm,所以需要创建此用户
$ sudo useradd --system --home=/opt/cloudera-manager/cm-5.14.1/run/cloudera-scm-server --no-create-home --shell=/bin/false --comment “Cloudera SCM User” cloudera-scm
4.主节点创建Cloudera Manager服务本地数据存储目录
$ sudo mkdir /var/lib/cloudera-scm-server
$ sudo chown cloudera-scm:cloudera-scm /var/lib/cloudera-scm-server
5.配置Agent
配置所有节点的Agent,路径:/opt/cloudera-manager/cm-5.14.1/etc/cloudera-scm-agent/config.ini,将server_host修改成主节点的主机名,如果主节点端口没有自定义,则不用修改。
6.下载mysql-connector-java.jar,并保存到所有主机的/usr/share/java目录下
7.配置mysql,可以参考这里
7.1 mysql安装在主节点上,使用mysql命令登录
7.2 新建一个scm用户,并赋予所有权限,密码是scm
mysql> grant all on . to ‘scm’@‘localhost’ identified by ‘temp’ with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)
7.3 创建数据库scm
7.4 初始化cloudera manager
[root@hserver1n ~]# /opt/cloudera-manager/cm-5.14.1/share/cmf/schema/scm_prepare_database.sh mysql scm scm scm
JAVA_HOME=/usr/java/jdk1.7.0_80
Verifying that we can write to /opt/cloudera-manager/cm-5.14.1/etc/cloudera-scm-server
Creating SCM configuration file in /opt/cloudera-manager/cm-5.14.1/etc/cloudera-scm-server
Executing: /usr/java/jdk1.7.0_80/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/opt/cloudera-manager/cm-5.14.1/share/cmf/schema/…/lib/* com.cloudera.enterprise.dbutil.DbCommandExecutor /opt/cloudera-manager/cm-5.14.1/etc/cloudera-scm-server/db.properties com.cloudera.cmf.db.
Wed Mar 21 14:09:40 CST 2018 WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
[ main] DbCommandExecutor INFO Successfully connected to database.
All done, your SCM database is configured correctly!
当看最后一句话,就说明初始化成功了
注意scm账户不能删除,因为cm以后还需要使用此账户,若想创建临时用户,则需要让CM创建用户和数据库,此时可以删除创建的临时用户。
可以使用命令:
/opt/cloudera-manager/cm-5.14.1/share/cmf/schema/scm_prepare_database.sh mysql -utemp -ptemp scm scm scm
8.将CDH安装包移动主节点的/opt/cloudera/parcel-repo目录下
移动的文件有:
将CDH-5.14.0-1.cdh5.14.0.p0.24-el7.parcel.sha1名称改成CDH-5.14.0-1.cdh5.14.0.p0.24-el7.parcel.sha
9.启动主节点的CM Server和所有节点的Agent
路径为:/opt/cloudera-manager/cm-5.14.1/etc/init.d
[root@hserver1n init.d]# ./cloudera-scm-server start
Starting cloudera-scm-server: [ OK ]
[root@hserver1n init.d]# ./cloudera-scm-agent start
Starting cloudera-scm-agent: [ OK ]
10.打开CM管理页面,网址为:http://hserver1n:7180,
用户名和密码都是admin
11.选择Cloudera Express
12.选择主机
13.群集安装
接下来会需要一段时间 网速不好建议更换网络
14.安装完成后,检查主机正确性
其中有两项需要修改,一个是修改swapping阀值,从30修改成10,已最大限度使用内存,第二项是关闭透明大页面压缩功能,提高性能。
15.选择要安装的服务,这里选择核心Hadoop,以后需要安装其它服务时,再根据需要安装
16.角色分配,尽量让角色均衡地分配到所有主机上,以减少某一台主机的压力
17.创建数据库用户,及相关数据库,并配置服务
mysql> grant all on . to ‘yanggy’@’%’ identified by ‘878963’ with grant option;
Query OK, 0 rows affected, 1 warning (0.03 sec)
mysql> create database hive;
Query OK, 1 row affected (0.01 sec)
mysql> create database hue;
Query OK, 1 row affected (0.01 sec)
mysql> create database ooz;
Query OK, 1 row affected (0.00 sec)
18.集群相关服务的配置
HDFS块大小默认是128M,我这里为测试方便,只配置了16M,其它的配置一些数据目录,日志目录,以及端口
19.集群搭建完成,并启动了相关服务
20.集群安装合成后的初始界面,可以很明显的看到集群中安装的服务和运行状况,红叹号是集群中某些配置、空间与CM期望的不一样,可以根据实际情况调整。
更多推荐
所有评论(0)