zoukankan      html  css  js  c++  java
  • Ntp时间服务器搭建

    1、服务端配置

    yum -y install ntp
    cp /etc/ntp.conf /etc/ntp.conf.bak

    egrep -v "^$|#" /etc/ntp.conf.bak >/etc/ntp.conf
    vim /etc/ntp.conf

    driftfile /var/lib/ntp/drift
    restrict default kod nomodify notrap nopeer noquery
    restrict -6 default kod nomodify notrap nopeer noquery
    restrict 127.0.0.1
    restrict -6 ::1
    允许内网其他机器同步时间
    restrict 172.16.1.0 mask 255.255.255.0 nomodify notr
    #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
    定义使用的上游 ntp服务器,将原来的注释
    server ntp1.aliyun.com
    server time1.aliyun.com
    允许上层时间服务器主动修改本机时间
    restrict time1.aliyun.com nomodify notrap noquery
    restrict ntp1.aliyun.com nomodify notrap noquery
    外部时间服务器不可用时,以本地时间作为时间服务
    server 127.127.1.0
    fudge 127.127.1.0 stratum 10
    includefile /etc/ntp/crypto/pw
    keys /etc/ntp/keys

    systemctl restart ntpd 

    systemctl enable ntpd 


    2、客户机配置
     yum -y install ntpdate
    同步时间,指定ip时间同步服务器
     ntpdate  10.0.0.111
    客户机写入定时任务
    0 0 * * * /usr/sbin/ntpdate 10.0.0.111

  • 相关阅读:
    大神的文章
    分布式锁
    分布式事务
    事务两三事
    spring框架笔记
    三个缓存数据库Redis、Memcache、MongoDB
    面向对象面试题
    SSM面试
    单例模式
    Spring Cloud面试题
  • 原文地址:https://www.cnblogs.com/wangyong-blog/p/13679206.html
Copyright © 2011-2022 走看看