执行ntptime报ERROR错误分析

一、解决方法

修改ntp.conf注释掉以下几行

tinker dispersion 100
tinker step 1800
tinker stepout 3600

或者直接用以下命令:

sed -i 's/tinker/#tinker/g' /etc/ntp.conf

最后重启ntp服务

sudo service ntpd restart

二、了解参数的作用

参考官方文档:http://doc.ntp.org/4.2.6/miscopt.html#tinker

  1. tinker [ allan allan | dispersion dispersion | freq freq | huffpuff huffpuff | panic panic | step step | stepout stepout ]

      This command alters certain system variables used by the clock discipline algorithm. The default values of these variables have been carefully optimized for a wide range of network speeds and reliability expectations. Very rarely is it necessary to change the default values; but, some folks can't resist twisting the knobs. The options are as follows:

     

      allan allan

      Spedifies the Allan intercept, which is a parameter of the PLL/FLL clock discipline algorithm, in seconds with default 1500 s.

     

      dispersion dispersion

      Specifies the dispersion increase rate in parts-per-million (PPM) with default 15 PPM.

     

      freq freq

      Spedifies the frequency offset in parts-per-million (PPM) with default the value in the frequency file.

     

      huffpuff huffpuff

      Spedifies the huff-n'-puff filter span, which determines the most recent interval the algorithm will search for a minimum delay. The lower limit is 900 s (15 m), but a more reasonable value is 7200 (2 hours).

     

      panic panic

      Spedifies the panic threshold in seconds with default 1000 s. If set to zero, the panic sanity check is disabled and a clock offset of any value will be accepted.

     

      step step

      Spedifies the step threshold in seconds. The default without this command is 0.128 s. If set to zero, step adjustments will never occur. Note: The kernel time discipline is disabled if the step threshold is set to zero or greater than 0.5 s.

     

      stepout stepout

      Specifies the stepout threshold in seconds. The default without this command is 900 s. If set to zero, popcorn spikes will not be suppressed.

三、寻找答案

  1. 为什么在时钟没有问题的情况下,执行ntptime会报ERROR错呢?

    经过验证"maximum error"的值达到16000000 us时候执行ntptime就会报错。

  2. “maximum error”这个值是干什么用的呢?

    kerninfo官方解释:获取并打印内核锁相环操作参数。仅当内核已针对精确计时功能进行了特殊修改时,此信息才可用。(官方文档:http://doc.ntp.org/4.2.6p2/ntpdc.html
  3. 临时解决方式
    Centos6.x 重启ntpd服务,"maximum error"会重新计算。
    Centos7.x 本地测试了下,重启ntpd服务,不会重新计算这个值,返而会变高。
  4. 验证参数问题
    在生产环境注释掉#tinker step 3600,观察两个小时后发现“maximum error” 这个值会上升,但是上升到一定程度后(不超过16s)会恢复到一个比较小的值。“estimated error”值也比较小。

    由此可以证实“tinker step 3600”会影响内核计算此值,参数中也有说明“ Note: The kernel time discipline is disabled if the step threshold is set to zero or greater than 0.5 s.”

 

 

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值