centos7.X hadoop集羣同步時間

1 、安裝ntp服務

yum install ntp ntpdate -y

設置192.168.31.101爲主服務器 其他的爲客戶端,添加如下設置

restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
server cn.pool.ntp.org perfer #網絡時間同步
server 192.168.31.101

在這裏插入圖片描述
服務開啓
systemctl status ntpd #查看狀態

(其他命令
systemctl start ntpd #啓動

systemctl stop ntpd #停止

systemctl status ntpd #重新啓動

systemctl restart ntpd #重新啓動

從服務器按照ntp服務然後配置
restrict -4 default kod notrap nomodify
restrict -6 default kod notrap nomodify
server 192.168.31.101 iburst

如圖:
在這裏插入圖片描述

然後手動同步時間:ntpdate 192.168.31.101(ntp主服務器開啓,從服務器服務需要關閉)

如果想定時進行時間校準,可以使用crond服務來定時執行。

00 1 * * * root /usr/sbin/ntpdate 192.168.56.121 >> /root/ntpdate.log 2>&1

https://blog.51cto.com/14482279/2428483

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章