zl程序教程

您现在的位置是:首页 >  其他

当前栏目

CentOS7集群安装配置NTP服务器

2023-04-18 12:57:54 时间

目录

1. 准备节点

不管你有多少个节点,肯定要有一个 server 角色,至于谁是 server 你来决定。 例如下面这样,我们姑且假设有这样四个节点

192.168.11.101(server端)
192.168.11.102(client端)
192.168.11.103(client端)
192.168.11.104(client端)
192.168.11.xxx(client端)
...

2. 安装配置 server 节点

2.1 下载安装

yum install ntp ntpdate

2.2 编辑配置文件

vim /etc/ntp.conf

...(省略)
server 192.168.11.101(server节点的IP地址)
fudge 127.127.1.0 stratum 11

2.3 启动服务

systemctl start ntpd
systemctl enable ntpd.service #设置开机启动服务 

3. 安装配置 Client 节点

在所有 Client 节点上完成以下操作

3.1 下载安装

yum install ntp ntpdate

3.2 同步时间

ntpdate -d -b 192.168.11.101

3.3 编辑配置文件

...(省略)
server 192.168.11.101(server节点的IP地址)
fudge 127.127.1.0 stratum 11

3.4 启动服务

systemctl start ntpdate
systemctl enable ntpdate.service #设置开机启动服务 

4. 测试

所有节点执行 date 命令看时间是否一致即可。