多台linux服务器时间同步

一、设置A服务器为时间服务器(加入A服务器IP为172.18.102.2)

1 修改 /etc/ntp.conf,如下所示:

 命令:vi /etc/ntp.conf

 内容:

  # Undisciplined Local Clock. This is a fake driver intended for backup
  # and when no outside source of synchronized time is available.
  server 127.127.1.0 # local clock
  #fudge 127.127.1.0 stratum 10

2 启动时间服务器,命令如下:

 service ntpd status

 service ntpd start

3 查看启动结果,如下所示:

 命令:ntpq -p

 结果:

  remote refid st t when poll reach delay offset jitter
  ==============================================================================
  *LOCAL(0) .LOCL. 5 l 2 64 377 0.000 0.000 0.000

4 设置自启动,命令如下:

 chkconfig ntpd on

二、设置需要同步的服务器

1 修改 /etc/ntp.conf,如下:

 命令:vi /etc/ntp.conf

 内容:

  # Undisciplined Local Clock. This is a fake driver intended for backup
  # and when no outside source of synchronized time is available.
  server 172.18.102.2 # local clock 与服务器A机时间同步
  fudge 172.18.102.2 stratum 10

2 启动时间服务器,命令如下:

 service ntpd status

 service ntpd start

3 查看启动结果,如下所示:

 命令:ntpq -p

 结果:

  remote refid st t when poll reach delay offset jitter
  ==============================================================================
  172.18.102.2 LOCAL(0) 6 u 5 64 1 1.377 -7077.8 0.000

4 设置自启动,命令如下:

 chkconfig ntpd on

5 立即同步

 ntpdate -d 172.18.102.2

 

上一篇:Linux时间的相关的操作


下一篇:element-ui上传文件带token