• chrony配置的和相关命令


    动态查看时间的命令

    watch -n 1 "date +%T"

    ntp命令

    查看时间同步源:

    $ chronyc sources -v

    查看时间同步源状态:

    $ chronyc sourcestats -v

    设置硬件时间

    硬件时间默认为UTC:

    $ timedatectl set-local-rtc 1

    启用NTP时间同步:

    $ timedatectl set-ntp yes

    校准时间服务器:

    $ chronyc tracking

    timedatectl set-time "YYYY-MM-DD HH:MM:SS" //设置时间和日期

    chrony.conf配置文件内容介绍

    $ cat /etc/chrony.conf
    
    # 使用pool.ntp.org项目中的公共服务器。以server开,理论上你想添加多少时间服务器都可以。
    # 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
    
    # 根据实际时间计算出服务器增减时间的比率,然后记录到一个文件中,在系统重启后为系统做出最佳时间补偿调整。
    driftfile /var/lib/chrony/drift
    
    # chronyd根据需求减慢或加速时间调整,
    # 在某些情况下系统时钟可能漂移过快,导致时间调整用时过长。
    # 该指令强制chronyd调整时期,大于某个阀值时步进调整系统时钟。
    # 只有在因chronyd启动时间超过指定的限制时(可使用负值来禁用限制)没有更多时钟更新时才生效。
    makestep 1.0 3
    
    # 将启用一个内核模式,在该模式中,系统时间每11分钟会拷贝到实时时钟(RTC)。
    rtcsync
    
    # Enable hardware timestamping on all interfaces that support it.
    # 通过使用hwtimestamp指令启用硬件时间戳
    #hwtimestamp eth0
    #hwtimestamp eth1
    #hwtimestamp *
    
    # Increase the minimum number of selectable sources required to adjust
    # the system clock.
    #minsources 2
    
    # 指定一台主机、子网,或者网络以允许或拒绝NTP连接到扮演时钟服务器的机器
    #allow 192.168.0.0/16
    #deny 192.168/16
    
    #即使自己未能通过网络时间服务器同步到时间,也允许将本地时间作为标准时间授时给其它客户端(内网环境下一定要注释此项); # Serve time even if not synchronized to a time source. local stratum 10 # 指定包含NTP验证密钥的文件。 #keyfile /etc/chrony.keys # 指定日志文件的目录,经过我多次测试在centos7上,实际上这个目录是空的,不知道为啥,请各位大神留言交流一下。 logdir /var/log/chrony # Select which information is logged. #log measurements statistics tracking
  • 相关阅读:
    瀑布流
    进度条
    图片延迟加载、scroll
    scroll 滚动广告
    json
    样式更改
    js 不同浏览器的宽度获取
    孤立点挖掘算法
    数据结构算法代码
    深入浅出JMS(一)--JMS基本概念
  • 原文地址:https://www.cnblogs.com/withfeel/p/10735810.html
Copyright © 2020-2023  润新知