1.时间服务器设置
指定一台特定的机器,作为时间服务器,为集群提供集群的标准时间;该服务器可以与外部网络同步时间,也可以使用硬件的时间。
1.1 安装ntp服务
检查服务器的系统是否安装了ntp服务:
rpm -qa|grep ntp
如果没有安装,那么安装ntp服务:
yum install -y ntp
1.2 修改配置
修改时间服务器ntp的配置文件(vim /etc/ntp.conf):
#注释掉下面的行
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
#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
#修改如下内容
server 时间服务器的IP地址
修改时间服务器系统时间与硬件时间同步(/etc/sys):
SYNC_HWCLOCK=yes
重启ntpd服务并开机启动:
service ntpd start
systemctl enable ntpd
2. 同步服务器设置
2.1 安装ntp服务
安装ntp服务: