最近在搞测试的时候,发现服务器在和本地通信的时候,会出现超时的情况,首先排除了网络带宽的问题。然后在查看超时的服务器上的时间是发现了问题:有3台服务器的时间和本地时间相差很多。于是着手开始处理时间差。
安装:
yum install ntpdate
成功后执行:
ntpdate 210.72.145.44 --是中国国家授时中心的官方服务器IP,不是本地IP
如果你成功了,恭喜你。
但是我这里没有成功,报错如下:
11 Sep 04:34:28 ntpdate[2939]: no server suitable for synchronization found
所以你还缺少一下几个步骤。
首先确定自己能 ping通百度
/usr/sbin/ntpdate stdtime.gov.hk
执行:
ntpdate -d ntp.sjtu.edu.cn
或者:
ntpdate -d 182.92.12.11
此时再查看一下 date,完成。