ntpdate不同步问题

文章描述了一名技术人员处理客户数据库服务器时间与北京时间不一致的问题。通过检查定时任务和日志,发现时间同步未生效。在紧急情况下,他们手动执行NTPdate命令暂时解决。随后,为了更稳定地同步时间,技术人员安装并配置了chrony服务,从192.168.100.250获取时间源,确保了时间的准确同步。
摘要由CSDN通过智能技术生成

中午正吃饭,客户打来电话,有个数据库时间和北京时间相差10多分钟了,影响到同步任务,赶紧赶回到电脑边查看,该机器是台虚拟机,操作系统是oracle linux 7.9。

1、定时任务中有时间同步的,且cron日志一直有显示执行,但机器时间和北京时间相差10多分钟。

 2、因业务紧急,直接手动执行命令,同步成功

 3、/var/log/message中没有任何关于时间同步的信息。客户查看云平台时间都和北京时间一致,赶紧安抚客户,不再使用ntpdate方式,修改成chrony了

[root@xgfwdb ~]#yum -y install chrony
[root@xgfwdb ~]#systemctl enable chronyd
[root@xgfwdb ~]#systemctl start chronyd
[root@xgfwdb ~]#systemctl status chronyd
编辑/etc/chrony.conf文件,增加以下时间源
server 192.168.100.250 iburst

[root@xgfwdb ~]#systemctl restart chronyd
[root@xgfwdb ~]#timedatectl status   # 查看时间同步状态
[root@xgfwdb ~]#timedatectl set-ntp true  # 开启网络时间同步

[root@xgfwdb ~]#   chronyc sources -v
210 Number of sources = 2

  .-- 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               
===========================================================================
^? bogon                         0   9     0     -     +0ns[   +0ns] +/-        0ns
^* 192.168.100.250    4   8   377   274   +307us[ +506us] +/-   51ms
 

rpm -qa | grep chrony
systemctl is-enable chronyd
systemctl enable chronyd --- 开机自启动
systemctl start chronyd --- 启动
systemctl restart chronyd
server 172.23.11.240 iburst

时钟配置-linux8-linux 8
 yum -y install chrony

 cp /etc/chrony.conf /etc/chrony.conf.bak
 echo ' ' >> /etc/chrony.conf
 echo 'server 59.78.109.11 iburst' >> /etc/chrony.conf
 echo 'server 202.120.111.3 iburst' >> /etc/chrony.conf
 echo 'server 202.120.111.30 iburst' >> /etc/chrony.conf
 systemctl restart chronyd && systemctl enable chronyd
 
 chronyc tracking

  hwclock --systohc; hwclock -w;date;hwclock

chronyc 命令
查看ntp时钟源  #chronyc sources -v  或者
   

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值