假设服务器分别为:1.1.1.2 1.1.1.3
检查ntp服务是否安装
rpm -qa | grep ntp
ntp-x.x.x.x
ntpdate-x.x.x.x
fontpackage-filesystem-x.x.x.x
python-ntplib-x.x.x.x
修改配置文件
vim /etc/ntp.conf
driftfile /var/lib/ntp/drift
restrict default nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
disable monitor
server 1.1.1.2
server 1.1.1.3
启动ntp服务并加入开机自启动
systemctl restart ntpd
systemctl enable ntpd
手动同步时间
如果当前时间和ntp时间差距较大,需要关闭ntp后手动同步下时间
date
ntpdate 1.1.1.2
date
systemctl stop ntpd
ntpdate 1.1.1.2
date
systemctl start ntpd
ntpd -p