hghac集群服务器时间同步(chrony同步)
文章目录
- 环境
- 文档用途
- 详细信息
环境
系统平台:银河麒麟(龙芯)svs,银河麒麟 (X86_64),银河麒麟 (飞腾),银河麒麟 (鲲鹏),银河麒麟 (海光),银河麒麟 (龙芯)
版本:4.5
文档用途
1、hghac集群使用etcd或者zookeeper监控组件,需要监控组件所在服务器时间一致才能保障hghac集群的高可用性和稳定性,对于时间不一致的服务器需要做时间同步。
2、银河麒麟系统默认安装了chrony同步工具,相对于其他的时间同步工具,chrony是轻量级的时间同步工具,具有更加先进的算法,更高的时间精度和稳定性,以及chrony配置相对简单,
下文介绍如何使用chrony工具做时间同步。
详细信息
1、确定已经安装rpm包
[root@dsmart ~]# rpm -qa | grep chronychrony-3.4-1.el7.x86_64
2、服务端配置
vim /etc/chrony.conf# Allow NTP client access from local network.#allow x.x.0.0/16allow x.x.10.44/23 ##允许哪些客户端来同步主机的时间# Serve time even if not synchronized to a time source.local stratum 10 ##本机不同步任何主机时间,本机作为时间源systemctl restart chronyd.service ##重启配置文件
3、客户端配置
vim /etc/chrony.conf#server 0.centos.pool.ntp.org iburst#server 1.centos.pool.ntp.org iburst#server 2.centos.pool.ntp.org iburst#server 3.centos.pool.ntp.org iburst server x.x.10.60 iburst ##本机同步x.x.10.60主机的时间systemctl restart chronyd.service ##重启配置文件
4、客户端查看时间同步源
chronyc sources -v 210 Number of sources = 1.-- 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===============================================================================^* x.x.10.60 2 6 17 33 +3518ns[ +24us] +/- 15ms
5、注意事项:
01、工具默认使用123/UDP端口协议,若没有关闭防火墙,请开通udp 123端口号
02、涉密机时间修改之后,时间一会又跳回去了,解决办法:安全卡时间同步关掉。