华硕路由系统时间未与NTP服务器同步,cdh时间同步遇到的坑【NTP时间同步服务器】...

本文介绍了如何配置NTP服务来实现Linux系统的主从时间同步。主要步骤包括在主节点上安装并配置ntpd服务,编辑ntp.conf文件,设置允许同步的IP范围,启动ntpd服务,并确保系统启动时自动运行。同时,文章还展示了从节点如何使用ntpdate命令及cron定时任务定期与主节点同步时间。
摘要由CSDN通过智能技术生成

2使用ntp配置时间同步

集群时间同步(主节点)

1) rpm -qa |grep ntpd 》》没有安装则需要安装此服务 》》yum install ntp

2) vi /etc/ntp.conf

去掉这个注释,将地址改成网段地址

restrict 192.168.80.0 mask 255.255.255.0 nomodify notrap(ip改成自己主节点的ip)

注释掉这几个

#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

fudge 127.127.1.0 stratum 10

3) vi /etc/sysconfig/ntpd 加入下面一句话,用于配置boot时间和系统时间同步

SYNC_HWCLOCK=yes

4) 启动ntpd服务器

sudo service ntpd start

sudo service ntpd status

chkconfig ntpd on

chkconfig --list |grep ntpd

?

客户机配置(从节点)

使用ntpdate? master(主节点的ip) 即可同步

用定时任务自动同步ntp时间?

crontab -e

?

00 1 * * * root /usr/sbin/ntpdate 10.205.246.11 >> /root/ntpdate.log 2>&1

这样,每天 1:00 Linux 系统就会自动的进行网络时间校准。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值