前言:时间服务器应用于集群服务器时间不同步,数据时间问题不一致,主要解决,集群所有服务器时间同步一致。
首要条件,需要确定,网段是否互通;下面开始配置:
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的服务器段都可以使用此段服务器
重启服务
systemctl restart ntpd
用ntpstat来检查效果【大概几秒钟就可以看到效果】
客户端配置(注意: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
重启服务
systemctl restart ntpd
用ntpstat来检查效果【大概需要等十五分钟,看到效果】
原文链接:https://blog.csdn.net/qq_37394476/article/details/124207266?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522166937964916782425637281%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=166937964916782425637281&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-6-124207266-null-null.article_score_rank_blog&utm_term=%E6%9C%8D%E5%8A%A1%E5%99%A8
- 海报