时间同步服务器搭建很方便,首先需在Server上安装NTP,在安装完毕后,在默认安装目录下:/etc/ntp.conf,仅仅需要修改配置文件中的代码即可。
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
这里的代码写的是服务器所设置的上层时间同步服务器,这里可以选择阿里云的时间同步服务器。
server ntp1.aliyun.com
server ntp2.aliyun.com
server ntp3.aliyun.com
server ntp4.aliyun.com
接着启动NTP服务,systemctl start ntp。
通过查看NTP状态可看到时间同步情况:
[root@localhost ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*120.25.115.20 10.137.53.7 2 u 35 64 377 23.659 4.980 2.734
+203.107.6.88 100.107.25.114 2 u 25 64 377 36.288 7.547 2.131
关于出现的remote offset 等含义,需要自己取调研。