時間同步服務器搭建很方便,首先需在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 等含義,需要自己取調研。