CentOS伺服器ntpdate同步

來源:互聯網
上載者:User

標籤:北京時間   伺服器   server   軟體包   adjust   

如有多台CentOS伺服器運行相同的服務,且對時間準確性要求較高,那必須保證多台伺服器時間統一。
 
最簡單的就是每台伺服器都用ntpdate同步同一台網路時間伺服器的時間。
 
1、輸入ntpdate time.nist.gov同步網路時間
[[email protected] ~]# 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!”儲存即可。
[[email protected] ~]# 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

CentOS伺服器ntpdate同步

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.