记一次chrony同步失败问题排查

Posted mathprice

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了记一次chrony同步失败问题排查相关的知识,希望对你有一定的参考价值。

先简单介绍一下chrony

chrony是linux7开始使用的时间同步服务,系统内置。比ntp更加快捷,简单

含有服务端和客户端:服务名为 chronyd,客户端工具chronyc

配置文件 /etc/chron.conf

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.102.131 iburst

此项为时间源地址

修改后需要重启服务,然后用chronyc sources -v 查看同步情况

[root@student ~]# chronyc sources -v
210 Number of sources = 1

  .-- Source mode  ‘^‘ = server, ‘=‘ = peer, ‘#‘ = local clock.
 / .- Source state ‘*‘ = current synced, ‘+‘ = combined , ‘-‘ = not combined,
| /   ‘?‘ = unreachable, ‘x‘ = time may be in error, ‘~‘ = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                     |          |  zzzz = estimated error.
||                                 |    |          
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^? 192.168.102.131               0   8     0     -     +0ns[   +0ns] +/-    0ns

这是服务器不可达,时间未同步的反馈

 

[root@student ~]# chronyc sources -v
210 Number of sources = 1

  .-- Source mode  ‘^‘ = server, ‘=‘ = peer, ‘#‘ = local clock.
 / .- Source state ‘*‘ = current synced, ‘+‘ = combined , ‘-‘ = not combined,
| /   ‘?‘ = unreachable, ‘x‘ = time may be in error, ‘~‘ = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                     |          |  zzzz = estimated error.
||                                 |    |          
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 192.168.102.131               3   6    17    13  +5813ns[ +120us] +/-   41ms

这是正常同步的信息反馈

 

理论上,只要服务安装了,配置文件没错,重启过服务,关闭了selinux和firewalld,网络通,就会很对进行同步,此次却无法进行同步。

结果发现是客户端的chrony版本比服务端的chrony版本高导致,全部更新到最新版本后马上就同步了

 

以上是关于记一次chrony同步失败问题排查的主要内容,如果未能解决你的问题,请参考以下文章

记一次Redis错误排查经历(redis cluster 节点重启后无限同步问题)

记一次Redis错误排查经历(redis cluster 节点重启后无限同步问题)

记一次LINUX-CRONTAB失败的排查案例

记一次并发引起的问题及排查过程

记一次Elasticsearch GeoIpDownloader的启动异常排查过程

记一次 spark rdd 写数据到 hbase 报 NPE 的问题排查