Linux同步网络时间

来源:互联网 发布:网络被骗多少钱立案 编辑:程序博客网 时间:2024/06/06 05:55

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

安装:

yum install ntpdate

 

ntpdate简单用法:

# ntpdate ip# ntpdate 210.72.145.44

 

 

date命令
date :查看当前时间,结果如下:Tue Mar 4 01:36:45 CST 2014date -s 09:38:40 :设置当前时间,结果如下:Tue Mar 4 09:38:40 CST 2014

 

 
ntpdate命令
ntpdate -u 210.72.145.44 :网络时间同步命令

 注意:若不加上-u参数, 会出现以下提示:no server suitable for synchronization found

-u:从man ntpdate中可以看出-u参数可以越过防火墙与主机同步;210.72.145.44:中国国家授时中心的官方服务器。

 

 
ntp常用服务器
中国国家授时中心:210.72.145.44NTP服务器(上海) :ntp.api.bz

 

 美国:time.nist.gov 复旦:ntp.fudan.edu.cn 微软公司授时主机(美国) :time.windows.com 台警大授时中心(台湾):asia.pool.ntp.org

 

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

 

 

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

 

Name

IPLocation210.72.145.44210.72.145.44中国(国家授时中心)133.100.11.8133.100.11.8日本(福冈大学)time-a.nist.gov129.6.15.28NIST,Gaithersburg,Marylandtime-b.nist.gov129.6.15.29NIST,Gaithersburg,Marylandtime-a.timefreq.bldrdoc.gov132.163.4.101NIST,Boulder,Coloradotime-b.timefreq.bldrdoc.gov132.163.4.102NIST,Boulder,Coloradotime-c.timefreq.bldrdoc.gov132.163.4.103NIST,Boulder,Coloradoutcnist.colorado.edu128.138.140.44UniversityofColorado,Bouldertime.nist.gov192.43.244.18NCAR,Boulder,Coloradotime-nw.nist.gov131.107.1.10Microsoft,Redmond,Washingtonnist1.symmetricom.com69.25.96.13Symmetricom,SanJose,Californianist1-dc.glassey.com216.200.93.8Abovenet,Virginianist1-ny.glassey.com208.184.49.9Abovenet,NewYorkCitynist1-sj.glassey.com207.126.98.204Abovenet,SanJose,Californianist1.aol-ca.truetime.com207.200.81.113TrueTime,AOLfacility,Sunnyvale,Californianist1.aol-va.truetime.com64.236.96.53TrueTime,AOLfacility,Virginia

 

知识只有共享才能传播,才能推崇出新的知识,才能学到更多,这里写的每一篇文字/博客,基本都是从网上查询了一下资料然后记录下来,也有些是原滋原味搬了过来,也有时加了一些自己的想法
0 0
原创粉丝点击