Linux多台同步时间

  1. apt install -y chrony
  2. 查询当前时间服务器列表:chronyc -n sources -v
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    root@Kube-Node2:~# chronyc -n sources -v

    .-- Source mode '^' = server, '=' = peer, '#' = local clock.
    / .- Source state '*' = current best, '+' = combined, '-' = not combined,
    | / 'x' = may be in error, '~' = too variable, '?' = unusable.
    || .- xxxx [ yyyy ] +/- zzzz
    || Reachability register (octal) -. | xxxx = adjusted offset,
    || Log2(Polling interval) --. | | yyyy = measured offset,
    || \ | | zzzz = estimated error.
    || | | \
    MS Name/IP address Stratum Poll Reach LastRx Last sample
    ===============================================================================
    ^? 91.189.94.4 2 6 3 3 -33ms[ -33ms] +/- 289ms
    ^- 91.189.91.157 2 6 77 4 -92ms[ -92ms] +/- 313ms
    ^- 185.125.190.57 2 6 137 3 -35ms[ -35ms] +/- 184ms
    ^- 185.125.190.58 2 6 77 3 -35ms[ -35ms] +/- 189ms
    ^+ 162.159.200.123 3 6 77 7 +1963us[+1710us] +/- 146ms
    ^+ 178.215.228.24 2 6 77 3 -90ms[ -90ms] +/- 233ms
    ^- 119.28.128.246 2 6 77 5 -4033us[-4033us] +/- 95ms
    ^* 118.143.17.83 2 6 77 6 -499us[ -754us] +/- 79ms
  3. 查询本地时间列表:chronyc tracking
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    root@Kube-Node2:~# chronyc tracking
    Reference ID : 768F1153 (static-dia-83-17.143.118-on-nets.com)
    Stratum : 3
    Ref time (UTC) : Mon Sep 12 11:42:49 2022
    System time : 0.003299957 seconds slow of NTP time
    Last offset : -0.002819499 seconds
    RMS offset : 0.002819499 seconds
    Frequency : 6.147 ppm slow
    Residual freq : -0.737 ppm
    Skew : 41.831 ppm
    Root delay : 0.153409138 seconds
    Root dispersion : 0.003587042 seconds
    Update interval : 64.3 seconds
    Leap status : Normal
  4. 验证时间是否同步:data