linux 集群时间同步

检查ntp是否安装
rpm -qa|grep ntp
如果不是这三个 安装一下 yum -y install ntp

修改ntp配置文件
vi /etc/ntp.conf
1.授权网段上所有服务器都可以从这台服务器查询和同步时间
修改 #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
为 restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
这个1要是你对应的网段 我就是57

2.集群在局域网中,不适用互联网上的其他时间
修改
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 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

这四个是互联网上的时间服务器

3.当该节点丢失网络连接,依然可以采用本地时间作为时间服务器为集群中的其他节点提供时间同步
添加
server 127.127.1.0
当失去网络是可以采用本机的时间
fudge 127.127.1.0 stratum 10
时间服务器的登记,配置时间的精准度 一共15级
3. 修改/etc/sysconfig/ntpd文件
1.让硬件时间与系统时间一起同步
vi /etc/sysconfig/ntpd
SYNC_HWCLOCK=yes
4.重启ntpd服务
systemctl status ntpd
systemctl start ntpd
5.设置ntpd服务开机启动
//chkconfig ntpd on
systemctl enable ntpd

6.其他机器配置
*/1 * * * * /usr/sbin/ntpdate hadoop201
date -s “2019-12-24 22:22:22”

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值