适用版本
OAT 所有版本。
问题现象
clockdiff 命令报错:clockdiff: xx.xx.xx.xx is down。
解决方法
首先查看 clockdiff 的版本,命令语句如下,如果该版本过低,可能会存在 bug,建议升级到 2023 年 4 月之后的 clockdiff 版本,详情可以参考:https://github.com/iputils/iputils/issues/326。
clockdiff -V
如果不存在 clockdiff 的版本问题,则可以使用下面的命令来判断时间同步误差。
适用 ping 命令来判断。
[root@localhost ~]# ping -T tsandaddr xxx.xxx.12.7 -c 2返回结果如下:
PING xxx.xxx.12.7 (xxx.xxx.12.7) 56(124) bytes of data. 64 bytes from xxx.xxx.12.7: icmp_seq=1 ttl=64 time=0.146 ms TS: xxx.xxx.12.123 22649606 absolute xxx.xxx.12.7 -15 <== 这个值代表node之间的时间差,单位是ms xxx.xxx.12.7 0 xxx.xxx.12.123 15 64 bytes from xxx.xxx.12.7: icmp_seq=2 ttl=64 time=0.172 ms TS: xxx.xxx.12.123 22650627 absolute xxx.xxx.12.7 -14 <== 这个值代表node之间的时间差,单位是ms xxx.xxx.12.7 0 xxx.xxx.12.123 14 --- xxx.xxx.12.7 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1021ms rtt min/avg/max/mdev = 0.146/0.159/0.172/0.013 ms使用 strace 命令来判断。
[root@localhost ~]# strace clockdiff xxx.xxx.12.7返回结果如下:
... ... openat(AT_FDCWD, "/etc/localtime", O_RDONLY|O_CLOEXEC) = 4 fstat(4, {st_mode=S_IFREG|0644, st_size=582, ...}) = 0 fstat(4, {st_mode=S_IFREG|0644, st_size=582, ...}) = 0 read(4, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0\0\0\3\0\0\0\0"..., 4096) = 582 lseek(4, -357, SEEK_CUR) = 225 read(4, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0\0\0\3\0\0\0\0"..., 4096) = 357 close(4) = 0 write(1, "\n", 1 ) = 1 write(1, "host=xxx.xx.12.7 rtt=0(0)ms/0ms "..., 75host=xxx.xx.12.7 rtt=0(0)ms/0ms delta=-15ms/-14ms Tue Feb 14 14:17:27 2023 ) = 75 close(1) = 0 close(2) = 0 exit_group(0) = ? +++ exited with 0 +++