规划
服务器
角色
一、修改主机名配置hosts
cm-server
systemctl stop firewalld
systemctl disable firewalld.service
hostnamectl set-hostname cm-server #更改个主机名
sed -i 's/SELINUX=enforcing/SELINUX=disable/g' /etc/selinux/config
setenforce 0
cat >>/etc/hosts<<EOF #添加各个节点hosts解析
172.16.1.100 cm-server
172.16.1.101 hadoop-1
172.16.1.102 hadoop-2
172.16.1.103 hadoop-3
EOF
hadoop-1
systemctl stop firewalld
systemctl disable firewalld.service
hostnamectl set-hostname hadoop-1 #更改个主机名
sed -i 's/SELINUX=enforcing/SELINUX=disable/g' /etc/selinux/config
setenforce 0
cat >>/etc/hosts<<EOF #添加各个节点hosts解析
172.16.1.100 cm-server
172.16.1.101 hadoop-1
172.16.1.102 hadoop-2
172.16.1.103 hadoop-3
EOF
hadoop-2
systemctl stop firewalld
systemctl disable firewalld.service
hostnamectl set-hostname hadoop-2 #更改个主机名
sed -i 's/SELINUX=enforcing/SELINUX=disable/g' /etc/selinux/config
setenforce 0
cat >>/etc/hosts<<EOF #添加各个节点hosts解析
172.16.1.100 cm-server
172.16.1.101 hadoop-1
172.16.1.102 hadoop-2
172.16.1.103 hadoop-3
EOF
hadoop-3
systemctl stop firewalld
systemctl disable firewalld
hostnamectl set-hostname hadoop-3 #更改个主机名
sed -i 's/SELINUX=enforcing/SELINUX=disable/g' /etc/selinux/config
setenforce 0
cat >>/etc/hosts<<EOF #添加各个节点hosts解析
172.16.1.100 cm-server
172.16.1.101 hadoop-1
172.16.1.102 hadoop-2
172.16.1.103 hadoop-3
EOF
二、配置cm-server免密钥登录其他节点
ssh-keygen -t rsa #在cm-server生成密钥对
for num in `seq 1 3`;do ssh-copy-id -i /root/.ssh/id_rsa.pub root@hadoop-$num;done
三、安装NTP服务
所有机器都需要安装
1.安装ntp包
yum -y install ntp
四、修改配置文件及重启
1.编辑/etc/ntp.conf文件以添加NTP服务器,如以下示例所示。
cm-server(192.168.130.144为ntp内部服务器)
driftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
server 192.168.130.144 iburst
restrict 192.168.130.144 nomodify notrap noquery
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
hadoop-1
同上
hadoop-2
同上
hadoop-3
同上
2.修改服务器配置文件(三台服务器)
vim /etc/ntp/step-tickers
0.centos.pool.ntp.org
3.启动ntpd服务
systemctl start ntpd
4.配置ntpd服务开机启动
systemctl enable ntpd
5.将系统时钟同步到NTP服务器
ntpdate -u <ntp_server>
6.将硬件时钟与系统时钟同步
hwclock --systohc
7.测试
ntpq -p
##四、其他配置
所有服务器配置
重启永久生效:
vi /etc/sysctl.conf
#设定swappiness
vm.swappiness=10
#然后将同一命令添加到 /etc/rc.local 等初始化脚本中,以便在系统重启时予以设置。以下主机将受到影响:
vi /etc/rc.local
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled