NTP服务器时间同步

1. NTP服务器时间同步

⑴ vi /etc/ntp.conf

restrict 127.0.0.1

restrict -6 ::1

restrict 10.1.4.130 mask 255.255.255.0 nomodify notrap

server  127.127.1.0     # local clock

fudge   127.127.1.0 stratum 10

⑵ 启动ntp服务
#/etc/init.d/ntpd start
添加到自启动
所有节点执行如下命令,让每次系统启动的时候自动启动ntp服务:
chkconfig --level 35 ntpd on

客户端设置

[root@namenode01 ~]#vi /etc/ntp.conf

driftfile /var/lib/ntp/drift 文件里有

server 10.1.4.130

restrict 101.4.130 nomodify notrap noquery

server  127.127.1.0     # local clock

fudge   127.127.1.0 stratum 10

Npt主服务器ip要去掉,只是针对客户的而言

[root@namenode ~]# for i in {32,33,34};do scp /etc/ntp.conf root@10.1.4.1$i:/etc/ntp.conf; done

启动服务

/etc/init.d/ntpd start
添加到自启动
所有节点执行如下命令,让每次系统启动的时候自动启动ntp服务:
chkconfig --level 35 ntpd on

 

所有客户端手动同步时间

[root@namenode01 ~]#ntpdate -u manager

[root@namenode01 ~]# crontab -e

*/5 * * * * root /usr/sbin/ntpdate 10.1.4.130; /sbin/hwclock -w

[root@masternode02 ~]# service crond restart ;chkconfig --level 35 crond on

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值