服务器时钟同步

1.安装ntpd服务(所有服务器)

[root@master ~]# yum install -y ntp

2.设定master为时间服务器

#修改ntp配置文件
[root@master ~]# vi /etc/ntp.conf

在“server 3.centos.pool.ntp.org iburst”后追加以下内容:

server master
restrict master nomodify notrap noquery
server 127.127.1.0
fudge 127.127.1.0 stratum 10

3.修改其余节点ntp配置文件

server master
server 127.127.1.0
fudge 127.127.1.0 stratum 10

4.启动master上的ntp服务

#启动ntpd服务
[root@master ~]# service ntpd start
#设置开机自启
[root@master ~]# chkconfig ntpd on

5.启动其余节点的ntp服务

#先同步master服务器上的时间
[root@slave1 ~]# ntpdate master
#启动ntpd服务
[root@slave1 ~]# service ntpd start
#设置开机自启
[root@slave1 ~]# chkconfig ntpd on

6.在其余节点添加定时任务

[root@slave1 ~]# crontab -e

*/10 * * * * /usr/sbin/ntpdate master

猜你喜欢

转载自blog.csdn.net/tour9566/article/details/89042741