达梦数据库集群多节点时间同步(搭建NTP服务器)

前言

在实际生产环境中集群的各节点的时间,在运行中时间的偏差会逐渐增大。这时我们可以通过搭建NTP服务来保证所有节点的时间同步。

1、环境

2台(CentOS7.X),NTP服务器IP:10.10.35.116,客户端IP:10.10.35.114

2、配置yum源,服务端安装ntp并配置

vim /etc/yum.repos.d/CentOS-Base.repo

在这里插入图片描述
----清理yum源

yum clean all

----查看源

yum list all

----安装NTP

yum install ntp

----修改配置文件:

vim /etc/ntp.conf

在restrict ::1下面添加如下几行

restrict default nomodify
server 127.127.1.0  # local clock
fudge 127.127.1.0 stratum 10
logfile /var/log/ntp.log   #日志文件

注释掉下面几行:

#Please consider joining the pool (http://www.pool.ntp.org/join.html).
#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

接着启动ntp服务,并且记得关闭防火墙

systemctl restart ntpd.service
systemctl enable ntpd.service

3、客户端配置

----安装NTP

yum install ntp

----编辑NTP配置文件,添加内容如下

vim /etc/ntp.conf
server 10.10.35.116 iburst
fudge 127.127.1.0 stratum 10
logfile /var/log/ntp.conf

接着启动ntp服务,并且关闭防火墙

systemctl restart ntpd.service
systemctl enable ntpd.service

大概3-5分钟就会自动同步了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值