zoukankan      html  css  js  c++  java
  • LINUX服务器集群时间同步之NTP配置

    NTP(network time protocol)

    NTP是由NTP客户端和NTP服务器构成,客户端的时间从NTP服务器上取得即可。一般是一个linux服务器集群中配置一台NTP服务器,其他的机器上都启动NTP客户端,然后同步时间。

    经常会把同步时间的操作放到crontab中定时执行

    NTP服务器配置:

    服务器开启ntp服务
    ntpd -c /etc/ntp.conf
    配置文件是ntp.conf,在这个文件中可以配置取时间的服务器IP,可以配置成自身,以自身的时间为同步时间。还可以限制客户端IP
    ntpq可以输出ntpd的状态,命令:watch ntpq -p

    ntp.conf配置说明:

    restrict default noquery notrust nomodify #默认NTP客户端允许的操作
    restrict 127.0.0.1 #允许时间同步的IP
    restrict 192.168.0.0 mask 255.255.0.0 #允许时间同步的子网
    fudge 127.127.1.0 stratum 3
    server 127.127.1.0 #ntpd服务器获取时间的来源,可以是自身或者其他的提供NTP服务的服务器
    driftfile /etc/ntp.drift
    logfile ar/log/ntp.log 

    NTP服务占用的端口是123,UDP协议

    客户端:
    #synchronization time from server 10.15.22.38
    */5 * * * * /usr/sbin/ntpdate 10.15.22.38 > /dev/null 2>&1
    使用ntpdate取时间服务器时间,时间服务器部署有ntpd服务

  • 相关阅读:
    unable to retrieve container logs for docker kubernetes
    Restart container within pod
    Kubernetes1.3:POD生命周期管理
    Options of the DB storage of prometheus
    prometheus重启hang住问题记录
    prometheus交流资源
    nc 从服务器上传下载文件
    负载均衡监控需求
    prometheus消耗内存问题
    10.Docker 镜像使用
  • 原文地址:https://www.cnblogs.com/sliverdang/p/linux_ntp.html
Copyright © 2011-2022 走看看