本帖最后由 年轻的虚无主义者 于 2023-6-16 17:37 编辑
配置时间同步本次有Master主节点和Slave从节点,Master为上游NTP服务器,下游服务器无论多少台都同Slave一样的配置在Master节点上部署chrony服务器,允许其他节点同步时间,启动服务并设置为开机启动;在Slave节点上指定Master节点为上游NTP服务器,重启服务并设为开机启动。
[root@Master /]# yum install -y chrony && systemctl enable chronyd [root@Master /]# vi /etc/chrony.conf allow 192.168.0.0/16 #根据自身IP段进行配置,意为允许广播到的网络范围 local stratum 10 [root@Master /]# systemctl start chronyd [root@Slave /]# yum install -y chrony && systemctl enable chronyd [root@Slave /]# vi /etc/chrony.conf server Master节点IP iburst
注意:修改时区-如果时间不是CST时区可以修改回来,根据需要,此处为CST+8时区 注意域名解析服务器,因为是通过主机名解析不是直接通过IP地址,如果域名解析没有配置好,那么时间同步不会成功,CST:中央标准时区。UTC:世界协调时间。我国为CST+8的时间标准。
[root@Master /]# date 2018年 03月 02日 星期五 14:09:45 CST [root@Master /]# tzselect #设置时区 时区的设置文件:/etc/timezone 时间相关文件:/etc/localtime 时间相关的文件:/usr/share/zoneinfo/Asia 这里边放着亚洲主要城市的时间 设置时间 rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|