luozheng.bigdata | luozheng.bigdata1 | luozheng.bigdata2 |
---|---|---|
192.168.211.129 | 192.168.211.131 | 192.168.211.133 |
DataNode | DataNode | DataNode |
NameNode | / | / |
/ | / | SecondaryNameNode |
/ | ResourceManager | / |
NodeManager | NodeManager | NodeManager |
JobHistoryServer | / | / |
当前搭建的hadoop分布式情况如上表所示,现在把bigdata作为时间服务器,其他两台节点定时同步bigdata节点的时间。
步骤如下:
1、首先检查ntp是否有安装
rpm -qa | grep ntp

2、修改配置文件:主要修改3个地方
vi /etc/ntp.conf



3、编辑/etc/sysconfig/ntpd文件
vi /etc/sysconfig/ntpd
主要是添加如下内容:
SYNC_HWCLOCK=yes
4、查看服务是否启动,如果没有启动,通过service ntpd start来启动,或是通过service ntpd restart来重启
service ntpd status

设置服务开机自启动:
chkconfig ntpd on
5、其他节点使用开启定时任务来进行时间同步
记住要在root权限下配置!!!!!
记住要在root权限下配置!!!!!
记住要在root权限下配置!!!!!
crontab -e
0-59/10 * * * *
6、测试,在luozheng.bigdata1和luozheng.bigdata2节点上直接运行如下命令:
#添加-d的作用是为了查看详细的信息
/usr/sbin/ntpdate -d luozheng.bigdata


网友评论