本博文记录,使用chrony完成时间同步,centos7系统默认自带。
阿里云公共NTP服务器:
腾讯公共NTP服务器:time1-5.cloud.tencent.com
大学NTP服务器:
国家授时中心服务器:210.72.145.44
rpm -qa |grep chrony yum -y install chronysystemctl start chronyd.servicesystemctl enable chronyd.servicesystemctl status chronyd.servicevi /etc/chrony.conf 设置时间服务器# 修改server设置国内时间服务器
# 单个方式
server ntp1.aliyun.com iburst# 多个方式
server 0.ntp1.aliyun.com iburst # 阿里
server 1.time1.cloud.tencent.com #腾讯
chronyc -a makestep chronyc sources -vrpm -qa |grep chrony yum -y install chrony# centos7 配置方式
firewall-cmd --add-service=ntp --permanent
firewall-cmd --reload
vi /etc/chrony.conf,内容如下:# 内网集群
server 集群时间服务器ip iburst# 允许其他节点连接
allow 0.0.0.0/0 local stratum 10 #不去同步任何人的时间。时间同步服务级别
timedatectltimedatectl set-timezone Asia/Shanghaichronyc -a makestepsystemctl restart chronyd.servicesystemctl status chronyd.servicevi /etc/chrony.conf# 配置时间服务器
server 集群时间服务器ip iburst
systemctl restart chronyd.servicechronyc sources -v