【Linux】- 同步网络时间

转自:Linux同步网络时间

Linux服务器运行久时,系统时间就会存在一定的误差,一般情况下可以使用date命令进行时间设置,但在做数据库集群分片等操作时对多台机器的时间差是有要求的,此时就需要使用ntpdate进行时间同步。

1 yum install -y ntpdate

ntpdate语法:

1 ntpdate [-46bBdqsuv] [-a key#] [-e delay] [-k file] [-p samples] [-o version#] [-t timeo] [-U username] server

示例:

1 ntpdate -u 210.72.145.44 #210.72.145.44:中国国家授时中心的官方服务器。
 

注意:若不加上-u参数, 会出现以下提示:no server suitable for synchronization found。从man ntpdate中可以看出-u参数可以越过防火墙与主机同步。

ntp常用服务器:

  1. 中国国家授时中心:210.72.145.44
  2. NTP服务器(上海) :ntp.api.bz
  3. 美国:time.nist.gov
  4. 复旦:ntp.fudan.edu.cn
  5. 微软公司授时主机(美国) :time.windows.com
  6. 台警大授时中心(台湾):asia.pool.ntp.org

经测试中国国家授时中心与NTP上海服务器可以正常同步时间,注意需要加上-u参数!

以下是一些可用的NTP服务器地址:

Name

IP Location
210.72.145.44 210.72.145.44 中国(国家授时中心)
133.100.11.8 133.100.11.8 日本(福冈大学)
time-a.nist.gov 129.6.15.28 NIST,Gaithersburg,Maryland
time-b.nist.gov 129.6.15.29 NIST,Gaithersburg,Maryland
time-a.timefreq.bldrdoc.gov 132.163.4.101 NIST,Boulder,Colorado
time-b.timefreq.bldrdoc.gov 132.163.4.102 NIST,Boulder,Colorado
time-c.timefreq.bldrdoc.gov 132.163.4.103 NIST,Boulder,Colorado
utcnist.colorado.edu 128.138.140.44 UniversityofColorado,Boulder
time.nist.gov 192.43.244.18 NCAR,Boulder,Colorado
time-nw.nist.gov 131.107.1.10 Microsoft,Redmond,Washington
nist1.symmetricom.com 69.25.96.13 Symmetricom,SanJose,California
nist1-dc.glassey.com 216.200.93.8 Abovenet,Virginia
nist1-ny.glassey.com 208.184.49.9 Abovenet,NewYorkCity
nist1-sj.glassey.com 207.126.98.204 Abovenet,SanJose,California
nist1.aol-ca.truetime.com 207.200.81.113 TrueTime,AOLfacility,Sunnyvale,California
nist1.aol-va.truetime.com 64.236.96.53 TrueTime,AOLfacility,Virginia

猜你喜欢

转载自www.cnblogs.com/wangwust/p/11330718.html
今日推荐