CDH6.2.0集群的搭建
CDH6.2.0集群的搭建

CDH6.2.0集群的搭建

1、准备阶段

准备虚拟机,按照个人需求。这里假定有三台机器,设置一号为主机。三号为mysql机。
注意:每做完一个阶段都要记得打快照,以免 不可恢复。

2、修改IP和主机名

1、修改主机名

hostnamectl set-hostname 主机名

2、修改IP地址

vi /etc/sysconfig/network-scripts/ifcfg-ens33
notion image
需要注意查看本机ip并保证本机IP前三个数字与虚拟机相同,不然会导致无法ping通。

3、重启虚拟机并查看ip和hostname是否修改成功

service network restart

4、验证网络是否能ping通

3、系统环境配置

1、配置域名映射

vi /etc/hosts
格式如下(中间用空格隔开):
192.168.233.xxx host1
192.168.233.xxx host2
192.168.233.xxx host3
每一台虚拟机上都需要配置

2、配置免密登录

1、生成密钥对
2、ssh-keygen -t rsa 直接回车
3、cd .ssh
ssh-copy-id 192.168.233.xxx
每台机器上配该机器和其他几台的免密,比如在第一台上要配置第一台、第二台以及第三台的免密登录。
4、ssh 192.168.233.xxx验证

3、关闭防火墙

notion image
systemctl stop firewalld systemctl disable firewalld

4、关闭SELINUX

setenforce 0
vi /etc/selinux/config
修改内容:SELINUX=disable

5、安装JDK

注意:将JDK安装在/usr/java内,否则会导致无法检测到。
1、查看有哪些jdk包: rpm -qa | grep java
2、删除已有的包(带openjdk): rpm -e --nodeps java~~
3、vi /etc/profile
notion image
4、source /etc/profile
5、java -version验证
6、权限问题
java -version:chmod 777 jdk/bin/java jps:chmod +x jdk/bin/jps

6、配置时间同步

1、安装chrony
yum install chrony
2、在主节点上配置 vi /etc/chrony.conf
server ntp.aliyun.com iburst
allow all
local stratum 10
3、在副节点上
vi /etc/chrony.conf server 192.168.233.101 iburst (地址表示主节点ip)
 
4、启动chrony并设置开机自启
systemctl enable chronyd.service systemctl restart chronyd.service
 
5、timedatectl查看服务
6、chronyc trcking 查看延时

7、修改系统参数

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'
 

8、安装httpd

1、所有位置
yum -y install httpd
2、启动
service httpd start service httpd status

9、下载第三方依赖包

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

10、安装Mysql 在cdh03这一台机器上

1、安装下列组件
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
2、启动
systemctl start mysqld systemctl enable mysqld
3、设置无密码状态
vi /etc/my.cnf 添加: skip-grant-tables 退出后重启生效:systemctl restart mysqld
4、设置
登录:mysql -uroot -p 密码123456 use mysql; 修改密码:update user set authentication_string=password("123456") where user='root'; 刷新:flush privileges; 退出后再次登录mysql -uroot -p use mysql;会报错,执行下面语句: set password = PASSWORD('123456'); 如果执行成功: ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; flush privileges; quit; 如果执行失败:
notion image
5、赋权
登录:mysql -uroot -p123456 建立数据库: 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赋权: use mysql; select host from user where user = 'root'; update user set host='%' where user = 'root'; flush privileges; quit;
6、设置允许外网访问
先打开防火墙: systemctl start firewalld systemctl status firewalld firewall-cmd --list-all 查看3306端口: firewall-cmd --query-port=3306/tcp
重启防火墙: service firewalld restart 再次查看3306端口: firewall-cmd --query-port=3306/tcp

11、上传mysql驱动jar包

三个机器都要上传
mkdir /usr/share/java 将jar包上传到该目录下 mv jar mysql-connector-java.jar

12、CM组件和节点安装

1、cdh2 cdh3只上传agent和daemons包
2、cdh1三个都上传
安装: 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 yum localinstall -y cloudera-manager-server-6.2.0-968826.el7.x86_64.rpm

13、安装CDH6.2.0

1、下载好CDH组件
2、在CDH1节点上传
3、移动到指定目录
mv CDH-6.2.0-1.cdh6.2.0.p0.967373-el7.parcel* /opt/cloudera/parcel-repo/ mv PHOENIX-5.0.0-cdh6.2.0.p0.1308267-el7.parcel* /opt/cloudera/parcel-repo/ mv manifest.json /opt/cloudera/parcel-repo/ mv PHOENIX-1.0.jar /opt/cloudera/csd/
4、修改server配置文件
vi /etc/cloudera-scm-server/db.properties
notion image
5、修改agent配置文件
所有节点 vi /etc/cloudera-scm-agent/config.ini 修改localhost为cdh1

4、启动集群

所有节点关闭防火墙: systemctl stop firewalld systemctl disable firewalld cdh1上启动server、agent: systemctl start cloudera-scm-server systemctl start cloudera-scm-agent 其他节点: systemctl start cloudera-scm-agent
查看日志信息: tail -200f /var/log/cloudera-scm-server/cloudera-scm-server.log
等待一段时间再访问
如果检测不到cdh:chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo/