zoukankan      html  css  js  c++  java
  • ubuntu同步Centos7的chrony

    设置了2台ubuntu18-server同步Centos7的chrony,记录,备查。

    Centos7服务端

    1. $yum -y install chrony

    2. $systemctl start chronyd

    3. $systemctl enable chronyd

    4. $cat /etc/chrony.conf    #修改配置文件

    # Use public servers from the pool.ntp.org project.

    # Please consider joining the pool (http://www.pool.ntp.org/join.html).

    #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     //用#号注释原来的源,共4行

    server ntp.aliyun.com iburst                //添加新的NTP时间源,iburst参数可以实现立即同步

    server ntp.fudan.edu.cn  iburst 

    # Allow NTP client access from local network.

    allow 20.0.46.0/24     //允许20.0.46.0网段的客户端请求同步本机的时间

    5. 开启网络时间同步:timedatectl set-ntp true

    6. 查看NTP是否已经启用:$ timedatectl

          Local time: 二 2021-01-05 11:44:03 CST

      Universal time: 二 2021-01-05 03:44:03 UTC

            RTC time: 二 2021-01-05 03:44:03

           Time zone: Asia/Shanghai (CST, +0800)

         NTP enabled: yes      //这里显示yes,代表NTP已启用

    NTP synchronized: yes

     RTC in local TZ: no

          DST active: n/a

    7. 查看chrony设置开机自启是否成功:

    $ sudo systemctl is-enabled chronyd

    enabled          //这里已经启用

    Ubuntu客户端

    1. sudo atp-get install chrony

    2. $ cat /etc/chrony/chrony.conf

    # Welcome to the chrony configuration file. See chrony.conf(5) for more

    # See http://www.pool.ntp.org/join.html for more information.

    #pool ntp.ubuntu.com        iburst maxsources 4

    #pool 0.ubuntu.pool.ntp.org iburst maxsources 1

    #pool 1.ubuntu.pool.ntp.org iburst maxsources 1

    #pool 2.ubuntu.pool.ntp.org iburst maxsources 2

    server 20.0.46.24 iburst       //向Centos服务器请求同步时间

    3. $ sudo service chronyd status

    4. $ sudo service chronyd start

    5. $ sudo timedatectl set-ntp ture/yes

    6. $ sudo timedatectl     //查看开启状态

                          Local time: Tue 2021-01-05 11:55:23 CST

                      Universal time: Tue 2021-01-05 03:55:23 UTC

                            RTC time: Tue 2021-01-05 03:55:23

                           Time zone: Asia/Shanghai (CST, +0800)

           System clock synchronized: yes

    systemd-timesyncd.service active: yes

                     RTC in local TZ: no

    7. 查看chrony设置开机自启是否成功:

    $ sudo systemctl is-enabled chronyd

    enabled          //这里已经启用

    其它用法:

    1.查看 ntp_servers:chronyc sources -v

    2.查看 ntp_servers 状态:chronyc sourcestats -v

    3.查看 ntp_servers 是否在线:chronyc activity -v

    4.查看 ntp 详细信息:chronyc tracking -v

    结束。

  • 相关阅读:
    QFramework 使用指南 2020(二):下载与版本介绍
    QFramework 使用指南 2020 (一): 概述
    Unity 游戏框架搭建 2018 (二) 单例的模板与最佳实践
    Unity 游戏框架搭建 2018 (一) 架构、框架与 QFramework 简介
    Unity 游戏框架搭建 2017 (二十三) 重构小工具 Platform
    Unity 游戏框架搭建 2017 (二十二) 简易引用计数器
    Unity 游戏框架搭建 2017 (二十一) 使用对象池时的一些细节
    你确定你会写 Dockerfile 吗?
    小白学 Python 爬虫(8):网页基础
    老司机大型车祸现场
  • 原文地址:https://www.cnblogs.com/liusingbon/p/14234729.html
Copyright © 2011-2022 走看看