歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> CentOS服務器ntpdate同步

CentOS服務器ntpdate同步

日期:2017/3/6 9:49:44   编辑:學習Linux

CentOS服務器ntpdate同步


CentOS服務器ntpdate同步


如有多台CentOS服務器運行相同的服務,且對時間准確性要求較高,那必須保證多台服務器時間統一。

最簡單的就是每台服務器都用ntpdate同步同一台網絡時間服務器的時間。

1、輸入ntpdate time.nist.gov同步網絡時間
[root@localhost ~]# ntpdate time.nist.gov
Mon Dec 17:11:43 ntpdate[5014]: adjust time server 207.200.81.113 offset -0.018788 sec
##如果出現上面的內容說明同步成功了,可以打開北京時間看看,1秒不差
注:如提示命令不存在,直接輸入:yum install ntp -y安裝ntp軟件包。

2、設置crontab計劃任務,使其定時自動同步
輸入命令crontab -e,按鍵盤字母”i”進入編輯狀態,然後按需求復制下面任意一條計劃內容到其中,最後按鍵盤“ESC”,並輸入“:wq!”保存即可。
[root@localhost ~]# crontab -e
#每隔1小時同步一次
* */1 * * * ntpdate time.nist.gov
或者
#每周六凌晨1點同步一次
0 1 * * 6 ntpdate time.nist.gov
如果上面time.nist.gov服務器同步不了,可以換下面幾個時間服務器試試:
time.nist.gov
time.nuri.net
0.asia.pool.ntp.org
1.asia.pool.ntp.org
2.asia.pool.ntp.org
3.asia.pool.ntp.org

http://xxxxxx/Linuxjc/1134122.html TechArticle

Copyright © Linux教程網 All Rights Reserved