master
vi /etc/ntp.conf
点击查看代码
[root@master hadoop]# vim /etc/ntp.conf
...前文省略..
# Hosts on local network are less restricted.
restrict 192.168.10.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
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
..前文省略..
disable monitor
server 127.127.1.0
fudge 127.127.1.0 stratum 10
[root@master hadoop]# vim /etc/sysconfig/ntpd
# Command line options for ntpd
OPTIONS="-g"
SYNC_HWCLOCK=yes
~
~
[root@master hadoop]# service ntpd restart
Redirecting to /bin/systemctl restart ntpd.service
```
</details>
从机
<details>
<summary>点击查看代码</summary>
[root@clone1 ~]# cd hadoop*
[root@clone1 hadoop-3.4.0]# crontab -e
*/1 * * * * /usr/sbin/ntpdate master // 分钟
crontab: installing new crontab
您在 /var/spool/mail/root 中有新邮件
</details>