国家结核控制规划和chronyd

  

国家结核控制规划和chronyd

  

立即同步时间的坏处,影响某些计划任务执行

  

<强>一、立即同步时间

  

方法一:

  
 <代码类=" language-bash "> ntpdate ntp.aliyun.com  
  

方法二:重启国家结核控制规划服务

  

方法三:重启chrony服务

  

<强>二,查看国家结核控制规划和chrony状态

  
 <代码类=" language-bash "> root@textbox ~ # chronyc来源- v
  210=1的来源
  
  ——源模式' ^ '=服务器,'='=同行,' # '=本地时钟。/?源状态‘*’=当前同步,' + '=组合,”——“=不结合,
  |/?'=遥不可及的,“x”=时间可能错误,' ~ '=时间变量。
  | | - xxxx (yyyy) +/-睡眠
  | |可达性(八进制)登记。| xxxx=调整抵消,
  | | Log2(轮询间隔)。| | yyyy=测量偏移,
  | | \ | |睡眠=估计错误。
  | | | | \
  女士的名字/IP地址地层调查达到LastRx最后的样本===============================================================================^ * localhost 3 6 17 2美国(美国)+ 661 + 62 +/- 88 ms
  (root@textbox ~) #  
  
 <代码类=" language-bash "> root@textbox ~ # ntpq - p
  远程refid st t当调查达到延迟补偿抖动==============================================================================* localhost 119.28.206.193 3 u 41 64 177 0.784 1.195 3656236  
  

<强>三,国家结核控制规划做服务端的设置

  
 <代码类=" language-bash "> #注释原来的国家结核控制规划服务器,原来的国家结核控制规划服务器都是centos.org美国的
  (root@textbox ~) # sed '/^服务器/年代/^/#//etc/ntp.参看我
  #添加两个阿里巴巴的
  (root@textbox ~) # sed 1服务器ntp.aliyun.com iburst/etc/ntp.参看我
  (root@textbox ~) # sed 1服务器ntp1.aliyun.com iburst/etc/ntp.参看我
  #重启服务
  (root@textbox ~) # systemctl ntpd重启
  #国家结核控制规划就这么简单,就可以当服务器使用了
  root@textbox ~ # ntpq - p
  远程refid st t当调查达到延迟补偿抖动==============================================================================+ 120.25.115.20 10.137.53.7 2 u 64 17 42.560 -8.795 6.944
  * 203.107.6.88 100.107.25.114 2 u 64 17 15.542 -7.021 6.460
  # 123端口,udp
  (root@textbox ~) #党卫军-lutnp | grep国家结核控制规划
  udp UNCONN 0 0 192.168.38.140:123 *: *用户:((ntpd, pid=61668, fd=19))
  udp UNCONN 0 0 127.0.0.1:123 *: *用户:((ntpd, pid=61668, fd=18))
  udp UNCONN 0 0 *: 123 *: *用户:((ntpd, pid=61668, fd=16))
  udp UNCONN 0 0 fe80:: 69 d0:5288: fda9:93ae % ens33:123::: *用户:((ntpd, pid=61668, fd=21))
  udp UNCONN 0 0:: 1:123::: *用户:((ntpd, pid=61668, fd=20))
  udp UNCONN 0 0::: 123::: *用户:((ntpd, pid=61668, fd=17))
  #用另一台服务器测试
  (root@linux5 ~) # ntpdate 192.168.38.140
  9月5日09:17:25 ntpdate[28423]:调整时间服务器192.168.38.140抵消-0.007790秒 
  

<强>四,chrony服务端配置

  

设置项比国家结核控制规划多

  
 <代码类=" language-bash "> [root@imooc-nginx ~] # sed '/^服务器/年代/^/#//etc/chrony.参看我
  (root@imooc-nginx ~) # sed 1服务器ntp.aliyun.com iburst/etc/chrony.参看我
  (root@imooc-nginx ~) # sed 1服务器0. cn.pool.ntp.org iburst/etc/chrony.参看我
  (root@imooc-nginx ~) # sed 1服务器ntp1.aliyun.com iburst/etc/chrony.参看我
  #即使当前时服务器未与指国家结核控制规划完定成时间同步,照样提供服务
  (root@imooc-nginx ~) # sed/etc/chrony. 1当地层10参看我
  #允许哪些服务器同步
  (root@imooc-nginx ~) # sed 1允许192.168.0.0/16/etc/chrony.参看我
  (root@imooc-nginx ~) # systemctl chronyd重启
  (root@imooc-nginx ~) # systemctl启用chronyd
  #查看chronyd状态
  root@imooc-nginx ~ # chronyc来源- v
  210的来源数量=3
  
  ——源模式' ^ '=服务器,'='=同行,' # '=本地时钟。/?源状态‘*’=当前同步,' + '=组合,”——“=不结合,
  |/?'=遥不可及的,“x”=时间可能错误,' ~ '=时间变量。
  | | - xxxx (yyyy) +/-睡眠
  | |可达性(八进制)登记。| xxxx=调整抵消,
  | | Log2(轮询间隔)。| | yyyy=测量偏移,
  | | \ | |睡眠=估计错误。
  | | | | \
  女士的名字/IP地址地层调查达到LastRx最后的样本===============================================================================^ + 120.25.115.20 2 6 17 4美国(美国)+ 591 + 766 +/- 21女士
  ^ 17 - 111.230.189.174 2 6 4 + 98(美国)+ 98 +/- 49
  ^ * 203.107.6.88 2 6 17 4 -187美元[-361]+/- 16女士
  #测试
  (root@textbox ~) # ntpdate 192.168.38.154
  9月5日09:33:25 ntpdate[61810]:调整时间服务器192.168.38.154抵消-0.010546秒

国家结核控制规划和chronyd