If more than one CentOS server is running the same service, and the time accuracy requirement is high, it is necessary to ensure that more than one server time is unified.
The simplest is that each server uses Ntpdate to synchronize the time of the same network time server.
1, input ntpdate time.nist.gov synchronization Network Time
[Email protected] ~]# ntpdate time.nist.gov
Mon Dec 17:11:43 ntpdate[5014]: Adjust time server 207.200.81.113 offset-0.018788 sec
# #如果出现上面的内容说明同步成功了, can open Beijing time to see, 1 seconds is not bad
Note: If the prompt command does not exist, direct input: Yum install ntp-y installs the NTP package.
2, set crontab scheduled tasks, so that their timing automatically synchronized
Enter the command crontab-e, press the keyboard letter "I" to enter the editing state, and then copy any of the following plan contents as required into it, press the keyboard "ESC" and enter ": wq!" Save it.
[Email protected] ~]# CRONTAB-E
#每隔1小时同步一次
* */1 * * * * ntpdate time.nist.gov
Or
#每周六凌晨1点同步一次
0 1 * * 6 ntpdate time.nist.gov
If the above time.nist.gov server is not synchronized, you can change the following several times the server to try:
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 Server Ntpdate Synchronization