ntp时间同步服务部署
服务端 m01(10.0.0.61)
1、yum安装ntp
yum -y install ntp
2、配置服务端软件(将主配置文件中原来的主配置文件21-24行进行注释)
#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 ntp.aliyun.com iburst
server 127.127.1.0
3、重启ntp
systemctl restart ntpd
ntpq -p 查看状态
(出现 LOCAL(0) .LOCL. 证明成功了)
时间匹配证明成功了
客户端
1、yum安装ntp
yum -y install ntp
2、输入命令
ntpdate 172.16.1.61 #跟服务端同步
3、编写定时任务
crontab -e
*/1 * * * * /usr/sbin/ntpdate 172.16.1.61 >/dev/null 2>&1