zoukankan      html  css  js  c++  java
  • 如何在linux 上配置NTP 时间同步?

    故障现象:

    有些应用场景,对时间同步的要求严格,需要用到NTP同步,如何在linux上配置NTP时间同步?

    解决方案:

    在linux 上配置NTP 时间同步,具休操作步骤,整理如下: 

    1、安装软件包(在服务端和客户端): yum install ntp ;

    2、服务器端配置 。

    例如: 

    首先,服务端设定IP地址为:192.168.146.110 
    修改ntp配置文件 

    vim /etc/ntp.conf 

    server 0.redhat.pool.ntp.org //设定上级服务器 

    restrict 192.168.146.0 mask 255.255.255.0 nomodify //设定哪些client机器可以和ntp server进行同步 


    //启动NTP服务前,手动校正一次时间 
    ntpdate 0.redhat.pool.ntp.org 
    service ntpd restart 
    chkconfig ntpd on 

    //查看ntp服务状态 
    netstat -ln | grep 123 
    ntpstat 

    3、客户端配置: 
    ntpdate 192.168.146.110 //与NTP server 同步时间 

    或者定期同步 
    crontab  -e 
    */5 * * * * /usr/sbin/ntpdate  -u 192.168.146.110     //每五分钟同步一次 
       重启crond服务/etc/init.d/crond restart 
    ntpq -p //查看同步状态

     
  • 相关阅读:
    代码检查工具介绍
    Eclipse利用代理快速安装插件
    toString结果
    Eclipse查看jdk源码
    java语言基础特性
    TODO、FIXME和XXX转载
    java泛型
    不良代码总结
    mockServer学习
    akka
  • 原文地址:https://www.cnblogs.com/clarke/p/5447260.html
Copyright © 2011-2022 走看看