容器学习笔记之CentOS7集群使用Chrony实现时间同步

 阅读目录

# yum install chrony -y# systemctl enable chronyd.service # systemctl restart chronyd.service # systemctl status chronyd.service
复制代码

在防火墙内放行,因NTP使用123/UDP端口协议,所以允许NTP服务即可。(如果已关闭防火墙请无视)

复制代码
# firewall-cmd --add-service=ntp --permanent # firewall-cmd --reload
复制代码

 

0x02 检查设置时区

复制代码
# timedatectl      Local time: Fri 2018-2-29 13:31:04 CST   Universal time: Fri 2018-2-29 05:31:04 UTC         RTC time: Fri 2018-2-29 08:17:20        Time zone: Asia/Shanghai (CST, +0800)      NTP enabled: yes NTP synchronized: yes  RTC in local TZ: no       DST active: n/a  #如果你当前的时区不正确,请按照以下操作设置。#查看所有可用的时区:# timedatectl list-timezones#筛选式查看在亚洲S开的上海可用时区:# timedatectl list-timezones |  grep  -E "Asia/S.*" Asia/Sakhalin Asia/Samarkand Asia/Seoul Asia/Shanghai Asia/Singapore Asia/Srednekolymsk  #设置当前系统为Asia/Shanghai上海时区:# timedatectl set-timezone Asia/Shanghai#设置完时区后,强制同步下系统时钟:# chronyc -a makestep200 OK
复制代码

 

0x03 Master节点配置chrony

此处选用的是阿里云的ntp服务server,地址为

ntp1.aliyun.com

当前是Master,ip地址为192.168.26.135,网段是192.168.26.0/24,配置详情如下,红色为更改部分

复制代码
# Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). # server 0.centos.pool.ntp.org iburst
                        
关键字:
50000+
5万行代码练就真实本领
17年
创办于2008年老牌培训机构
1000+
合作企业
98%
就业率

联系我们

电话咨询

0532-85025005

扫码添加微信