前言:时间服务器应用于集群服务器时间不同步,数据时间问题不一致,主要解决,集群所有服务器时间同步一致。

首要条件,需要确定,网段是否互通;下面开始配置:

1.安装ntp

        执行yum –y install ntp安装ntp

2.启动服务

systemctl start ntpd

3.设置开机自启动

systemctl enable ntpd

服务器配置(注意:ip仅供参考,请按照实际情况配置)

修改/etc/ntp.conf文件

restrict 192.168.0.0 mask 255.255.255.0   #添加此行--自己设置主机的ip加子网掩码;这句是手动增加的,意思是指定的192.168.0.0--192.168.0.254的服务器段都可以使用此段服务器

99949f939271dc5540de69e52327f5bf.png

重启服务

systemctl restart ntpd

用ntpstat来检查效果【大概几秒钟就可以看到效果】

4f2a05762eaa0db8503059c3ed8e70b2.png

客户端配置(注意:ip仅供参考,请按照实际情况配置

修改/etc/ntp.conf文件

#添加此行

server 192.168.231.3

#以下四行注释掉

# 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

f0d42e95b6b1934a85649521d1cdcec9.png

重启服务

systemctl restart ntpd

用ntpstat来检查效果【大概需要等十五分钟,看到效果】

22d441525a15c2b6857eed17881a0217.png

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐