zoukankan      html  css  js  c++  java
  • 实现集群-NTP时间同步

            Network Time Protocol(NTP,网络时间协议)用于同步它所有客户端时钟的服务。NTP服务器将本地系统的时钟与一个公共的NTP服务器同步然后作为时间主机提供服务,使本地网络的所有客户端能同步时钟。

            同步时钟最大的好处就是相关系统上日志文件中的数据,如果网络中使用中央日志主机集中管理日志,得到的日志结果就更能反映真实情况。在同步了时钟的网络中,集中式的性能监控、服务监控系统能实时的反应系统信息,系统管理员可以快速的检测和解决系统错误。

    1.配置客户端

    ##一台机器实现本地与远程服务器时间保持同步

    //安装ntpdate

    yum install ntpdate

    ntpdate无需任何依赖,也可以直接rpm安装

    rpm -ivh http://mirrors.aliyun.com/centos/7.5.1804/os/x86_64/Packages/ntpdate-4.2.6p5-28.el7.centos.x86_64.rpm

     

    //与远程机器时间同步

    # ntpdate ntp1.aliyun.com 19 Oct 10:07:54 ntpdate[17142]: adjust time server 120.25.115.20 offset 0.026562 sec

    //写入定时任何,即可实现自动同步时间

    # echo "*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com > /dev/null 2>&1" >> /var/spool/cron/root

    # crontab -l

    */5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com > /dev/null 2>&1

    2.搭建服务端ntp时间

    ##实现集群内时间保持同步

    1. 安装ntp

    [root@m01 ~]# yum install ntp

    2. 启动ntpd服务

    [root@m01 ~]# systemctl start ntpd

    [root@m01 ~]# systemctl enable ntpd

    3 其它内网机器同步NTP时间服务器

    [root@lb01 ~]# yum install ntpdate -y

    [root@lb01 ~]# date -s '20081024'

    [root@lb01 ~]# ntpdate 172.16.1.61

    [root@lb01 ~]# date

    Fri Oct 19 10:35:35 CST 2018

     

     

     

  • 相关阅读:
    Docker学习总结(四)--应用部署
    strcat的由来
    ubuntu man不到pthread_mutex_XX
    string::front
    string::find_last_of
    string::find_last_not_of
    string::find_first_of
    string::find_first_not_of
    string::erase
    string::empty
  • 原文地址:https://www.cnblogs.com/fangdecheng/p/9844929.html
Copyright © 2011-2022 走看看