centos7基于阿里云授时服务器进行本地ntp集群配置

引言:
​ 本地物理服务器集群搭建ntp时间同步环境,使用一台机器作为本地server端连接阿里云授时中心,其他节点配置本地server为首选。

本地集群server端配置

安装软件包

#yum install ntp -y ;

修改配置

# vim /etc/ntp.conf

# Hosts on local network are less restricted.
# 配置使用本ntp server的IP端
restrict 172.16.xx.0 mask 255.255.255.0 nomodify notrap
#使用阿里云的授时服务器
server time1.aliyun.com  prefer
server time2.aliyun.com
server time3.aliyun.com
server time4.aliyun.com
server time5.aliyun.com
server time6.aliyun.com
server time7.aliyun.com

重启服务

# service ntpd restart

检查状态

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*203.107.6.88    100.107.25.114   2 u   32   64  377   19.203   -1.571   0.264

​ 经查询,203.107.6.88 是time4.aliyun.com,配置生效。

本地其他节点配置

安装软件包

# yum install ntp -y ;

修改配置

# vim /etc/ntp.conf


server 172.16.xx.17 prefer #优先使用本地ntp服务器
server time1.aliyun.com #使用阿里云的授时服务器
server time2.aliyun.com
server time3.aliyun.com
server time4.aliyun.com
server time5.aliyun.com
server time6.aliyun.com
server time7.aliyun.com

启动服务

systemctl enable ntpd;
service ntpd start;
ntpq -p;

​ 启动ntp服务,同时设置服务开机自启

检查状态

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*node17          203.107.6.88     3 u    3   64   17    0.104   -1.316   1.241
+203.107.6.88    100.107.25.114   2 u    5   64   17   19.636   -2.990   2.205

​ 可以发现当前节点首先去本地NTP服务器同步时间,node17的ntp上级服务器为203.107.6.88。与17节点查询相同,服务正常。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值