首页 > 其他 > 详细

chronyd时间同步

时间:2020-08-15 13:23:08      阅读:70      评论:0      收藏:0      [点我收藏+]
环境:
服务端:centos7
客户端:centos6,centos8,Ubuntu18
关闭selinux ,firewalld ,ntpd服务

软件包:chrony.x86_64.rpm

服务名:chronyd

centos安装:yum install -y chrony
Ubuntu安装:apt install -y chrony

服务端:
查看安装配置文件:rpm -ql chrony
[09:13:39-root@localhost ~]#rpm -ql chrony
/etc/NetworkManager/dispatcher.d/20-chrony
/etc/chrony.conf
/etc/chrony.keys
/etc/dhcp/dhclient.d/chrony.sh
/etc/logrotate.d/chrony
/etc/sysconfig/chronyd
编辑配置文件:[09:15:24-root@localhost ~]#vim /etc/chrony.conf

server ntp.aliyun.com iburst (添加阿里云时间服务器)
#server 0.centos.pool.ntp.org iburst (注释centos官方的时钟服务器)
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst

allow 192.168.179.0/24 (开启需要同步时间的网段)

重启chronyd:systemctl restart chronyd

更改EST为CST:ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

同步阿里云时间:chronyc sources -v
查看时间:date

客户端:
安装chronyd服务
编辑配置文件:
server 192.168.179.131 iburst (添加本地时间服务器)
#server 0.rhel.pool.ntp.org iburst (注释掉)
#server 1.rhel.pool.ntp.org iburst
#server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst
启动服务并设置开机自启动:
/etc/init.d/chronyd start
chkconfig chronyd on
更改EST为CST
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
查看时间:date

如果本地时间服务器时间出现改动,可以重新加载chronyd服务来同步时间
客服端也需要重新加载chronyd服务

chronyd时间同步

原文:https://blog.51cto.com/13434656/2520543

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!