ntp 安装
说明:master,slave1,slave2三台服务器
每台服务器配置对应hosts
-
安装
yum install ntp
-
配置开机自启动
systemctl enable ntpd.service
systemctl list-unit-files
-
master配置
-
vim /etc/ntp.config
增加
restrict 127.0.0.1 restrict -6 ::1 restrict default nomodify notrap server 127.127.1.0 prefer includefile /etc/ntp/crypto/pw keys /etc/ntp/keys
-
-
slave节点配置
vim /etc/ntp.config
增加restrict default kod nomodify notrap nopeer noquery restrict -6 default kod nomodify notrap nopeer noquery restrict 127.0.0.1 restrict -6 ::1 server master includefile /etc/ntp/crypto/pw keys /etc/ntp/keys
-
启动ntp
service ntp start
-
更新master时间
ntpdate -v ntp1.aliyun.com
(ntp1.aliyun.com为ntp.congi下server中存在的服务) -
同步master
ntpdate -v master
-
查看同步
watch -ntpq -p