文章目录
一、前期准备
1、集群准备
1.1 准备三台设备
IP | 名称 |
---|---|
192.168.10.11 | cdh1 |
192.168.10.12 | cdh2 |
192.168.10.13 | cdh3 |
1.2 修改三台设备的主机名
hostnamectl set-hostname cdh1
1.3 修改IP地址(其他两台设备同时设置)
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
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=b90477b9-4bad-4687-92ab-dc9d4563fb56
DEVICE=ens33
ONBOOT=yes
CONNECTION_METERED=yes
IPADDR=192.168.10.11 #修改成自己想要的IP
NETMASK=255.255.255.0
GATEWAY=192.168.10.2
PREFIX=24
配置完成重启网卡
systemctl restart network
2、系统环境搭建
三台设备上进行网络配置,免密登录、防火墙关闭、selinux关闭
2.1 修改hosts域名映射
[root@localhost ~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.10.11 cdh1
192.168.10.12 cdh2
192.168.10.13 cdh3
2.1 免密登录
执行ssh-keygen -t rsa 直接回车就OK
在执行
ssh-copy-id 192.168.10.12
(在主节点执行)
2.3 防火墙、selinux关闭
systemctl stop firewalld
systemctl disabled firewalld
[root@localhost ~]# vim /etc/selinux/config
# 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 #将这里改为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
2.4 安装JDK
[root@localhost ~]# mkdir /usr/java
[root@localhost ~]# cd /usr/java
将jdk环境包拉入/usr/java下
[root@localhost ~]# tar -xzvf jdk软件包
修改环境变量
[root@localhost ~]# vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_181
export JRE_HOME=/usr/java/jdk1.8.0_181/jre
export CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
刷新
source /etc/profile
执行
javac -version
2.5 安装NTP(只需要在cdh1)
yum -y install ntp
修改配置文件
vim /etc/ntp.conf
首先 注释4个server 然后添加server主机ip
上面修改完成在配置
vim /etc/sysconfig/ntpd
配置文件最后面增加一条命令
SYNC_CLOCK=yes
修改完成,重启ntpd服务
systemctl start ntpd.service
systemctl enable ntpd.service
2.6 修改系统参数(cdh1)
sysctl vm.swappiness=10
echo 'vm.swappiness=10' >> /etc/sysctl.conf
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo 'echo never > /sys/kernel/mm/transparent_hugepage/defrag' >> /etc/rc.local
echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.local
2.7 安装httpd
yum -y install httpd
systemctl start httpd.service
systemctl status httpd.service
二、配置部署
1、下载第三方依赖包(每台都装)
yum -y install bind-utils
yum -y install chkconfig
yum -y install cyrus-sasl-gssapi
yum -y install cyrus-sasl-plain
yum -y install fuse
yum -y install fuse-libs
yum -y install gcc
yum -y install libxslt
yum -y install mod_ssl
yum -y install MySQL-python
yum -y install openssl
yum -y install openssl-devel
yum -y install perl
yum -y install portmap
yum -y install postgresql-server
yum -y install psmisc
yum -y install python-devel
yum -y install python-psycopg2
yum -y install python-setuptools
yum -y install sed
yum -y install sqlite
yum -y install swig
yum -y install zlib
2、安装MySQL(cdh3)
数据库只在cdh3 上面进行安装,将下面6个rpm包上传到集群中 rpm包自己百度云提取
链接:https://pan.baidu.com/s/1oO_38Wj5Ut1xcy9_EW7dOA
提取码:2bnw
2.1首先查看自己的集群中是否安装mysql数据库
rpm -qa | grep mysql // 这个命令就会查看该操作系统上是否已经安装了mysql数据库
要是安装了 通过 yum -y remove mysql 进行卸载
2.2 依次安装
rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-devel-5.7.19-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-client-5.7.19-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm --nodeps --force
启动mysql
systemctl start mysqld
systemctl enable mysqld
安装成功后 首先将数据库设置成无密码状态,需要修改配置
vim /etc/my.cnf
添加 skip-grant-tables 可保证为无密码状态
重启mysqld服务
systemctl restart mysqld
2.3 进入mysql数据库
选择数据库 use mysql;
修改密码为123456
update user set authentication_string=password("123456") where user='root';
flush privileges;
quit;
再次进入数据库,并创建几个数据库
mysql -u root -p 密码123456
选择数据库 use mysql;
use mysql; 会报错, 说让你重新设置密码.执行下面这一步,设置密码:
输入
set password = PASSWORD('123456');
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
flush privileges;
quit;
重新登录 mysql -u root -p 123456
use mysql;
create database cmf default character set = 'utf8';
create database amon default character set = 'utf8';
create database hue default character set = 'utf8';
create database oozie default character set = 'utf8';
create database lyz default character set = 'utf8';
对mysql 数据库赋权,任何服务器都可以连接它,执行下面几步操作:
select host from user where user = 'root';
update user set host='%' where user = 'root';
flush privileges;
quit;
设置允许外网访问当前的mysql
首先打开防火墙
systemctl start firewalld
firewall-cmd --list-all
查看3306端口是否开放
firewall-cmd --query-port=3306/tcp
开放3306端口
firewall-cmd --permanent --add-port=3306/tcp
重启防火墙
systemctl restart firewalld
再次查看3306端口是否开放
firewall-cmd --query-port=3306/tcp
查看目前防火墙
firewall-cmd --list-all
3、mysql-connector-java-5.1.39 上传整理
cdh1、cdh2、cdh3三台设备同时执行
- 创建目录
mkdir /usr/share/java - 将文件上传
将 mysql-connector-java-5.1.39.jar 上传到 /usr/share/java 目录下 - 改写
mv mysql-connector-java-5.1.39.jar mysql-connector-java.ja
4、CM组件和节点安装
4.1 组件
4.2 cdh2、cdh3集群只上传agent、daemons rpm包;cdh1 三个包全部上传
4.3 全部节点安装daemons和agent
yum localinstall -y cloudera-manager-daemons-6.2.0-968826.el7.x86_64.rpm
yum localinstall -y cloudera-manager-agent-6.2.0-968826.el7.x86_64.rpm
cdh1节点安装server
yum localinstall -y cloudera-manager-server-6.2.0-968826.el7.x86_64.rpm
5、下载安装CDH6.2.0
5.1 下载完成 在cdh1节点上传
cd /opt/cloudera/parcel-repo/目录下上传以下文件
CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel
CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel.sha
PHOENIX-5.0.0-cdh6.2.0.p0.1308267-el7.parcel
PHOENIX-5.0.0-cdh6.2.0.p0.1308267-el7.parcel.sha
manifest.json
cd /opt/cloudera/csd/
PHOENIX-1.0.jar
进入到parcel-repo目录下 效验 黄色框的字符码是否相等,来判断文件上传时是否正确
5.2 修改server配置文件
vim /etc/cloudera-scm-server/db.properties
12行去掉注释把localhost改成cdh3
15行去掉注释
18行去掉注释,把cmf改成root
21行去掉注释,密码那里填写123456
28行 setupType = EXTERNAL
5.3 在全部节点修改agent配置文件
vim /etc/cloudera-scm-agent/config.ini
15行把localhost修改为cdh1
三、启动CM,开始安装CDH集群
1、在cdh1上启动server和agent
systemctl start cloudera-scm-server
systemctl start cloudera-scm-agent
2、在cdh2、cdh3启动agent
systemctl start cloudera-scm-agent
3、另开一个会话,查看相关日志
tail -200f /var/log/cloudera-scm-server/cloudera-scm-server.log
4、查看7180端口是否生效
netstat -anpt | grep 7180
5、输入IP:7180登录页面
用户名:admin
密码:admin
操作web界面
群集名称可以随意起 按要求
选择自定义服务,先安装个zookeeper
到自定义角色分配 中,
Activity Monitor 我选择的是cdh1节点,zookeeper 我选择的是1-3 节点
数据库是在cdh3 上部署,然后主机名称为cdh3 数据库选择amon 用户名为root 密码 123456 然后点击测试连接