企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[官方网站][1] [参考博客][2] ## 安装 ~~~ yum install -y chrony ~~~ ### 服务端配置文件 ~~~ # Please consider joining the pool (http://www.pool.ntp.org/join.html). server cn.pool.ntp.org prefer server ntp1.aliyun.com iburst server time1.aliyun.com iburst stratumweight 0 driftfile /var/lib/chrony/drift # chronyd程序的主要行为之一,就是根据实际时间计算出计算机增减时间的比率,将它记录到一个文件中是最合理的,它会在重启后为系统时钟作出补偿,甚至可能的话,会从时钟服务器获得较好的估值。 rtcsync # rtcsync指令将启用一个内核模式,在该模式中,系统时间每11分钟会拷贝到实时时钟(RTC) makestep 10 3 # 如果误差大于10s,前3次update时间使用step而不是slew allow 10.0.0.0/24 bindcmdaddress 127.0.0.1 # 该指令允许你限制chronyd监听哪个网络接口的命令包(由chronyc执行)。该指令通过cmddeny机制提供了一个除上述限制以外可用的额外的访问控制等级。 bindcmdaddress ::1 local stratum 10 keyfile /etc/chrony.keys commandkey 1 generatecommandkey noclientlog logchange 0.5 logdir /var/log/chrony ~~~ ### 启动 ~~~ service chronyd start # centos 6 systemctl start chronyd # centos 7 ~~~ ### 客户端 ~~~ server 10.101.74.139 iburst # Ignore stratum in source selection. stratumweight 0 driftfile /var/lib/chrony/drift rtcsync makestep 10 3 makestep 1000 10 # Listen for commands only on localhost. bindcmdaddress 127.0.0.1 bindcmdaddress ::1 # Serve time even if not synchronized to any NTP server. local stratum 10 keyfile /etc/chrony.keys # Specify the key used as password for chronyc. commandkey 1 # Generate command key if missing. generatecommandkey # Disable logging of client accesses. noclientlog # Send a message to syslog if a clock adjustment is larger than 0.5 seconds. logchange 0.5 logdir /var/log/chrony #log measurements statistics tracking ~~~ ## 将硬件时间调节至系统时间 ~~~ hwclock --hctosys hwclock --systohc ~~~ > hwclock --systohc [1]:http://chrony.tuxfamily.org/ [2]:http://www.cnblogs.com/muahao/p/6410962.html