1 查看是否安装ntp服务 rpm -qa | grep ntp

2 如果没安装,执行 yum install ntp
3 编辑配置文件 vi /etc/ntp.conf

去掉第18行的# 修改成自己的网段
restrict 192.168.7.0 mask 255.255.255.0 nomodify notrap
注释掉以下几行(22行)
#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 127.127.1.0 #local clock
fudge 127.127.1.0 stratum 10
4 启动ntp服务(默认式开始)PC1 root用户操作
systemctl start ntpd
systemctl enable ntpd
5、同步服务器的时间(PC1) ntpdate cn.pool.ntp.org -->操作这一步时关闭ntp服务
6、如果另外两台的ntp的进程开启,那么需要关闭
7.第2、3台向第一台同步时间 ntpdate bigdata01
8.制定周期性时间同步计划任务(PC2、PC3定时向PC1手动同步时间)
在PC2 PC3每10分钟同步一次时间

# crontab -e
*/10 * * * * /usr/sbin/ntpdate hadoop.senior01
本文介绍如何在Linux系统中安装和配置NTP服务,包括检查安装状态、编辑配置文件、启动服务、同步时间等步骤,并提供了多台服务器间时间同步的具体操作。
754

被折叠的 条评论
为什么被折叠?



