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

2020-08-28  本文已影响0人  喵咪很生气

前言

在实际生产环境中集群的各节点的时间,在运行中时间的偏差会逐渐增大。这时我们可以通过搭建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
image.png
yum clean all
yum list all
yum list all
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

等待片刻时间就一致啦

O_O

上一篇 下一篇

猜你喜欢

热点阅读