检查服务器同步状态:ntptrace 192.168.server.ip
关于错误 8 Jul 18:20:45 ntpdate[4949]: no server suitable for synchronization found
使用 -d 命令查看错误
ntpdate -d 192.168.7.244
8 Jul 18:20:45 ntpdate[4949]: ntpdate 4.2.2p1@1.1570-o Thu Jan 17 18:14:10 UTC 2008 (1)
Looking for host 192.168.7.244 and service ntp
host found : rac01
transmit(192.168.7.244)
receive(192.168.7.244)
transmit(192.168.7.244)
receive(192.168.7.244)
transmit(192.168.7.244)
receive(192.168.7.244)
transmit(192.168.7.244)
receive(192.168.7.244)
transmit(192.168.7.244)
192.168.7.244:
Server dropped: strata too highserver 192.168.7.244, port 123
stratum 16, precision -20, leap 11, trust 000
refid [192.168.7.244], delay 0.02615, dispersion 0.00050
transmitted 4, in filter 4
reference time: 00000000.00000000 Thu, Feb 7 2036 14:28:16.000
originate timestamp: cc1d6e5e.ef02c0d8 Tue, Jul 8 2008 12:41:02.933
transmit timestamp: cc1dbdfd.3e598e10 Tue, Jul 8 2008 18:20:45.243
filter delay: 0.02759 0.02615 0.02753 0.02745
0.00000 0.00000 0.00000 0.00000
filter offset: -20382.3 -20382.3 -20382.3 -20382.3
0.000000 0.000000 0.000000 0.000000
delay 0.02615, dispersion 0.00050
offset -20382.309995
8 Jul 18:20:45 ntpdate[4949]: no server suitable for synchronization found
解决:
How about issuing the command "ntpq -p" on the server that's not
synchronizing and posting the output? That will tell us which internet
servers it can see, if any. My first guess would be that if it's not
synchronized, it's because it can't establish contact with anything to
synchronize with.
My second guess is that it might fail to synchronize because its own
local clock is too far off. If it's more than five minutes off, set the
local clock to approximately the correct time before starting ntp.
Finally, it might be failing to synchronize because your local clock is
drifting too fast. If the undisciplined local clock gains or loses too
much, it will never synchronize and stay synchronized. The limit is
about 500 parts per million.
用ntp同步时间, 出现the NTP socket is in use,exiting
如果使用了计划任务在crontab里只执行,就关闭ntpd服务
*/15 * * * * ntpdate 210.72.145.44
service ntpd stop
Q:
I have a machine which serves as NTP server. This
machine has more (3) Network interfaces (+ loopback). By default NTP
"binds" itself to all available interfaces, i.e. it listens on port 123
on all interfaces:
netstat -an|grep 123
udp 0 0 127.0.0.1.123 *.*
udp 0 0 1.2.3.4.123 *.*
udp 0 0 *.123 *.*
udp 0 0 1.2.5.4.123 *.*
udp 0 0 1.2.6.4.123 *.*
I would like to "bind" NTP to only one interface, say the 1.2.3.4. Is it possible? I do not find any hint on the net.
P:
As far as I know, no version of (x)ntpd can do this.
As
an alternative, you could use the "restrict" directive in /etc/ntp.conf
file to make the NTP server ignore any communication that comes from
the unauthorized interfaces. For example, to allow 1.2.3.4 and loopback
only, you might add this to /etc/ntp.conf:
# no restrictions for loopback...
restrict 127.0.0.1 mask 255.0.0.0
# no restrictions for 1.2.3.0/24
restrict 1.2.3.4 mask 255.255.255.0
# everything else is ignored
restrict default ignore
P:
ou might be able to exploit the fact that it only binds to the interfaces at start-up time .
Not very pretty but you could stop the other interfaces comming up then
start ntp then start the rest , or during rc2 ifconfig the ones you
don't want down before ntp start then start ntp and then the other
interfaces.
数据库服务器的时间与真实时间一旦出现差异,就要对数据库服务器进行时间同步。很多地方都把ntpdate放到cron中,5分钟自动同步一次。然而,这么做,常常会引会数据库ORA-01555,甚至db crash。
找到一种方法据说可以解决这个问题。即使用ntpd -x来同步时间 instead of ntpdate。
实际上ntpd,不只是一种时间服务器的server端,同时也可以做client端,相当于ntpdate。当它做client时,与ntpdate的差别是,ntpdate已近淘汰,ntpd则可看作是它升级版。
下面的方法是讲如何在linux的环境中设置ntpd:
1. 修改/etc/ntp.conf
2. 加入time server。每个数据库中心都应用会有一组时间服务器,可以找sa要, 比如国际站,加入:
server ntp1.alibaba.com
server ntp2.alibaba.com
server ntp3.alibaba.com
ntp.conf有很多参数,都忽略就行。
3. 修改/etc/sysconfig/ntpd, 加入-x参数,变成:
OPTIONS=”-U ntp -x -p /var/run/ntpd.pid”
这据说是为db同步所要求的。
4. 首先同步一次时间:
ntpdate time.nist.gov; hwclock –systohc
如果数据库还要在运行,建议不要这么做。待例行维护时再处理。
5. 然后启动ntpd:
/etc/init.d/ntpd start
6. 最后加入到自动启动列表:
chkconfig –level 2345 ntpd on