zoukankan      html  css  js  c++  java
  • CentOS服务器ntpdate同步

    如有多台CentOS服务器运行相同的服务,且对时间准确性要求较高,那必须保证多台服务器时间统一。
     
    最简单的就是每台服务器都用ntpdate同步同一台网络时间服务器的时间。
     
    1、输入ntpdate time.nist.gov同步网络时间
    [root@localhost ~]# ntpdate time.nist.gov
    Mon Dec 17:11:43 ntpdate[5014]: adjust time server 207.200.81.113 offset -0.018788 sec
    ##如果出现上面的内容说明同步成功了,可以打开北京时间看看,1秒不差
    注:如提示命令不存在,直接输入:yum install ntp -y安装ntp软件包。
     
    2、设置crontab计划任务,使其定时自动同步
    输入命令crontab -e,按键盘字母”i”进入编辑状态,然后按需求复制下面任意一条计划内容到其中,最后按键盘“ESC”,并输入“:wq!”保存即可。
    [root@localhost ~]# crontab -e
    #每隔1小时同步一次
    * */1 * * * ntpdate time.nist.gov
    或者
    #每周六凌晨1点同步一次
    0 1 * * 6 ntpdate time.nist.gov
    如果上面time.nist.gov服务器同步不了,可以换下面几个时间服务器试试:
    time.nist.gov
    time.nuri.net
    0.asia.pool.ntp.org
    1.asia.pool.ntp.org
    2.asia.pool.ntp.org
    3.asia.pool.ntp.org

  • 相关阅读:
    关于加法的类型转换
    设备事件
    html5 事件
    【环境安装】快速安转TensorFlow
    JApiDocs API文档-超级好用
    Docker(超级详细)
    SpringBoot整合Swagger
    Jenkins +Docker+Git 实现自动部署
    Git commit规范
    java支付宝生成二维码
  • 原文地址:https://www.cnblogs.com/webnote/p/6077485.html
Copyright © 2011-2022 走看看