美文网首页
hadoop集群时间同步

hadoop集群时间同步

作者: 紫苓 | 来源:发表于2018-06-14 23:49 被阅读70次
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
image.png
2、修改配置文件:主要修改3个地方
vi /etc/ntp.conf
image.png image.png
image.png
3、编辑/etc/sysconfig/ntpd文件
vi /etc/sysconfig/ntpd

主要是添加如下内容:

SYNC_HWCLOCK=yes
4、查看服务是否启动,如果没有启动,通过service ntpd start来启动,或是通过service ntpd restart来重启
service ntpd status
image.png

设置服务开机自启动:

chkconfig ntpd on
5、其他节点使用开启定时任务来进行时间同步

记住要在root权限下配置!!!!!
记住要在root权限下配置!!!!!
记住要在root权限下配置!!!!!

crontab -e

0-59/10 * * * *  

6、测试,在luozheng.bigdata1和luozheng.bigdata2节点上直接运行如下命令:
#添加-d的作用是为了查看详细的信息
/usr/sbin/ntpdate -d luozheng.bigdata
image.png
image.png

相关文章

网友评论

      本文标题:hadoop集群时间同步

      本文链接:https://www.haomeiwen.com/subject/dnpueftx.html