zoukankan      html  css  js  c++  java
  • chrony时间同步工具

    chrony

    RHEL/CentOS 6.x 下的时间同步基本是使用 ntpdate 和 ntpd 这两个工具实现的,但是这两个工具已经很古老了,RHEL/CentOS 7.x 已经将 chrony 作为默认时间同步工具了(其他 systemd 系统下无需安装 ntp/chrony,使用 systemd-timesyncd 服务即可)。

    chrony 简介

    chrony 是 RedHat 开发的,它是网络时间协议(NTP)的另一种实现;
    RHEL/CentOS 7.x 的默认时间同步工具,在 CentOS 6.8之后也添加上了这个工具;
    chrony 可以同时做为 ntp 服务的客户端和服务端;安装完后有两个程序 chronyd、chronyc:
    chronyd 是一个 daemon 守护进程,chronyc 是用来监控 chronyd 性能和配置参数的命令行工具。

    实验环境说明

    系统版本:CentOS 7.2 (1511)
    chrony_server(relay):192.168.255.103
    chrony_client:192.168.255.104

    chrony_server

    安装 chrony
    yum -y install chrony

    配置 chrony

    vim /etc/chrony.conf
    --- chrony.conf ---
    ## 上游公共 ntp 服务器
    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
    
    ## 允许 192.168.255.0/24 主机同步时间
    allow 192.168.255/24
    --- chrony.conf ---
    

    运行 chrony
    systemctl enable chronyd
    systemctl start chronyd

    timedatectl
    timedatectl status,查看时间同步状态;
    timedatectl set-ntp true,开启网络时间同步;

    chronyc 用法

    ## 查看 ntp_servers 状态
    chronyc sources -v
    
    ## 查看 ntp_sync 状态
    chronyc sourcestats -v
    
    ## 查看 ntp_servers 是否在线
    chronyc activity -v
    
    ## 查看 ntp 详细信息
    chronyc tracking -v
    

    chrony_client

    安装 chrony
    yum -y install chrony

    配置 chrony

    vim /etc/chrony.conf 
    --- chrony.conf ---
    ## 内网 ntp_server IP
    server 192.168.255.103 iburst
    
    ## 允许内网 ntp_server 进行时间同步
    allow 192.168.255.103
    --- chrony.conf ---
    

    运行 chrony
    systemctl enable chronyd
    systemctl start chronyd

    timedatectl
    timedatectl status,查看时间同步状态;
    timedatectl set-ntp true,开启网络时间同步;

    chronyc 用法

    ## 查看 ntp_servers 状态
    chronyc sources -v
    
    ## 查看 ntp_sync 状态
    chronyc sourcestats -v
    
    ## 查看 ntp_servers 是否在线
    chronyc activity -v
    
    ## 查看 ntp 详细信息
    chronyc tracking -v
    

    转载至:https://www.zfl9.com/chrony.html

  • 相关阅读:
    windows下安装python模块
    红包demo
    如何查看python 的api
    vscode 与 python 的约会
    默认构造函数
    关于重载
    转类型转换
    asm-offset.h 生成
    debian 7 安装
    emacs 定制进缩风格
  • 原文地址:https://www.cnblogs.com/yanling-coder/p/12803876.html
Copyright © 2011-2022 走看看