NTP集群搭建

第一步:所有节点安装ntp服务

sudo yum install -y ntp

第二步:修改配置文件(第一个节点,其它节点的server则修改为  server 192.168.163.0  )

sudo vi /etc/ntp.conf

statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

server ntp.aliyun.com
server ntp1.aliyun.com
server ntp2.aliyun.com
server ntp3.aliyun.com
server ntp4.aliyun.com
server ntp5.aliyun.com
server ntp6.aliyun.com
server ntp7.aliyun.com

# 不允许来自公网上ipv4和ipv6客户端的访问
restrict -4 default kod notrap nomodify nopeer noquery 
restrict -6 default kod notrap nomodify nopeer noquery
# 允许这个网段的对时请求
restrict 192.168.128.0 mask 255.255.255.0 nomodify 

第三步:同步时间

sudo ntpdate ntp.aliyun.com

第四步:启动NTP服务并查看状态

sudo systemctl start ntpd

sudo systemctl status ntpd

第五步:设置开机自启

sudo systemctl enable ntpd

第六步:查看时间是否同步(需等待一会)

ntpstat

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值