1. 时间同步
- master节点安装ntp服务
sudo apt-get install ntp
修改配置:
下图为master节点的内容:
sudo vim /etc/ntp.conf
第一个红框中的内容: 192.168.0.0 是所在网段(博主目前也有点晕, 因为博主当前所有机器处于192.168.0.100 - 192.168.0.199)
后面三个框内容为添加的
注: master节点是Ubuntu, slave节点是Centos, 所以两个配置文件内容是不一样的.
slave节点安装ntp(以下操作需要在salve1和slave2都进行操作):
在此之间, 设置hadoop用户的sudo权限.
su root
vi /etc/sudoers
在第100行左右加入如下信息, hadoop为新增的:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
hadoop ALL=(ALL) ALL
然后使用 exit, 退回到 hadoop用户:
安装ntp:
yum -y install ntp
启动ntp服务:
systemctl start ntpd.service
查看:
上面的结果是没有修改配置的结果, 下面修改配置.
修改配置:
sudo vi /etc/ntp.conf
将下图中红框部分注释, 添加黄框内容, 192.168.0.103 为master节点IP地址.
查看:
设置开机自动启动:
sudo systemctl enable ntpd.service
sudo systemctl enable ntpdate.service
如果需要手动同步时间需要先关闭ntp服务: