美文网首页
ntp 集群时间同步

ntp 集群时间同步

作者: 堂哥000 | 来源:发表于2018-12-08 21:49 被阅读3次

    sudo yum -y install ntp
    sudo vi /etc/ntp.conf
    修改,放开注释
    restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
    注释掉下面4个
    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
    退出保存
    sudo vi /etc/sysconfig/ntpd
    添加
    SYNC_HWCLOCK=yes
    退出保存
    sudo service ntpd status
    若出现ntpd dead but pid file exists不用管
    sudo service ntpd restart 执行两次
    开机启动
    sudo chkconfig ntpd on
    其他机器
    安装ntp
    yum -y install ntp
    sudo crontab -e
    添加
    */1 * * * * /usr/sbin/ntpdate hadoop01
    退出保存
    开机启动执行
    sudo chkconfig --add crond
    查看定时任务
    sudo crontab -l
    看状态
    sudo service crond status
    删除定时任务
    sudo crontab -r

    ntp 同步时间有限值,时间相差不能太大
    所以可以修改时间
    sudo date -s 21:12:50
    修改为与第一台时间相差不大的时间
    或者直接先同步网络时间
    sudo ntpdate ntp.api.bz

    相关文章

      网友评论

          本文标题:ntp 集群时间同步

          本文链接:https://www.haomeiwen.com/subject/pmjchqtx.html