CentOS伺服器ntpdate同步

2021-09-08 12:15:32 字數 846 閱讀 5042

如有多台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

Centos伺服器配置

是我安裝centos伺服器的過程,記錄下來,與大家一起分享。centos 6.2 centos 6.2 i386 bin 1.iso 32位 centos 6.2 x86 64 bin 1.iso 64位 安裝 centos時,選擇 basic server root密碼 root123 cento...

Centos 禁止連線伺服器 禁止訪問伺服器服務

今天遇到了個令人頭痛的事情,因為我所負責的專案是個整合專案,和第三方系統緊密相連,但由於第三方不靠譜總是忘記改連線位址導致在測試環境中連線著我的正式環境,使我正式環境資料一堆錯誤,一地雞毛 因此我決定將第三方系統中的測試環境在正式伺服器上加入訪問黑名單,於是我在網上看到一堆如下操作 vim etc ...

centos安裝DNS伺服器

最近裝了centos6.5,需要安裝乙個dns伺服器,找了好多文章都,摸索了一上午,終於解決,記錄如下 yum install y bind bind utils 內容如下 options 改為 any allow query 改為 any 在最後加入以下幾行 zone mycloud.lan in...