CDH集群搭建
基本环境
系统: centos 7
4个节点:
master 192.168.1.31 8g 2*4核 60g硬盘 ghome安装
slave1 192.168.1.41 4g 2*2核 40g硬盘 计算节点安装
slave2 192.168.1.42 4g 2*2核 40g硬盘 计算节点安装
slave3 192.168.1.43 4g 2*2核 40g硬盘 计算节点安装
网络环境设置
设置固定ip
su root
systemctl stop network.service
vi /etc/sysconfig/network-scripts/ifcfg-ens33
#注释所有IPV6*
#BOOTPROTO=dhcp ==》BOOTPROTO=static
#插入
IPADDR=192.168.1.*
GATEWAY=192.168.1.1
DNS1=8.8.8.8
(错误备忘:
一开始设置的是DNS=8.8.8.8,导致不能ping通外网
)
:wq
systemctl stop network.service
systemctl start network.service
设置域名映射
master> vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
## cloudera
192.168.1.31 master.reco.com master
192.168.1.41 slave1.reco.com slave1
192.168.1.42 slave2.reco.com slave2
192.168.1.43 slave3.reco.com slave3
:wq
master> scp /etc/hosts root@slave[1-3]:/etc/hosts
关闭防火墙和selinux
## 查看防火墙状态
firewall-cmd --state
## 关闭防火墙
systemctl stop firewalld
## 关闭开机启动
systemctl disable firewalld
##查看selinux状态
sestatus
##永久关闭
vi /etc/selinux/config
SELINUX=disabled
SELINUXTYPE=targeted
:wq
reboot
ssh免密登录
# 每个节点执行
ssh-keygen -t rsa (一路回车)
ls ~/.ssh (查看生成的id_rsa,id_rsa.pub -- 公钥和私钥)
#每个节点执行
ssh-copy-id root@master (将公钥都加到master节点)
#在master节点
cat ~/.ssh/authorized_keys (查看是否已添加所有节点)
#把master节点的keys复制到每台slave
scp ~/.ssh/authorized_keys root@slave[1-3]:~/.ssh/
#重启ssh服务(每个节点)
systemctl stop sshd.service
systemctl start sshd.service
#测试免密登录
ssh slave[1-3]
ntp时钟同步
rpm -q ntp
yum -y install ntp
ntpdate -u 202.112.10.36
vi /etc/ntp.conf
(删掉注释)restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
(删掉原有的server 0~4)
server 210.72.145.44 perfer
server 202.112.10.36
server 59.124.196.83
(添加)restrict 210.72.145.44 nomodify notrap noquery
restrict 202.112.10.36 nomodify notrap noquery
restrict 59.124.196.83 nomodify notrap noquery
server 127.127.1.0
fudge 127.127.1.0 stratum 10
:wq
systemctl stop ntpd.service
systemctl start ntpd.service
systemctl enable ntpd.service
netstat -tlunp | grep ntp
ntpq -p
vi /etc/ntp.conf
server 192.168.1.31
restrict 192.168.1.31 nomodify notrap noquery
server 127.127.1.0
fudge 127.127.1.0 stratum 10
:wq
ntpdate -u 192.168.1.31
systemctl stop ntpd.service
systemctl start ntpd.service
systemctl enable ntpd.service