1. 程式人生 > >[原]CentOS 7 chrony 筆記

[原]CentOS 7 chrony 筆記

tp服務器 sun enabled 世界 rtc 在線 name cti 一次

~]# timedatectl  status
      Local time: Sun 2018-08-26 21:01:15 CST        ==> 本地系統實際時間,設置時間timedatectl set-time 15:58:30
                                                                           設置日期timedatectl set-time 20151120
                                                                           設置時間日期timedatectl set
-time 16:10:40 2015-11-20 Universal time: Sun 2018-08-26 13:01:15 UTC ==> 世界統一時間 RTC time: Sun 2018-08-26 13:01:15 ==> 硬件時鐘的時間 Time zone: Asia/Shanghai (CST, +0800) ==> 當前時區,查看可用時區timedatectl list-timezones 設置當前時區timedatectl set
-timezone "Asia/Shanghai" 設置世界統一時區timedatectl set-timezone UTC NTP enabled: yes ==> 開啟自動同步時間服務器功能,timedatectl set-ntp true 或 timedatectl set-ntp false NTP synchronized: yes
==> 與時間服務器的同步狀態,如果顯示yes,則同步成功 RTC in local TZ: no ==> 將時區設置為本地時區,timedatectl set-local-rtc 1 硬件時鐘設置為協調世界時(UTC)timedatectl set-local-rtc 0 DST active: n/a [root@network ~]# chronyc sources -v 210 Number of sources = 1 .-- Source mode ^ = server, = = peer, # = local clock. / .- Source state * = current synced, + = combined , - = not combined, | / ? = unreachable, x = time may be in error, ~ = time too variable. || .- 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 =============================================================================== ^? controller 9 6 37 47 +123us[ +123us] +/- 25ms ==>如果前面是有個?表明時間服務器不可達 [root@network ~]# chronyc sources -v 210 Number of sources = 1 .-- Source mode ^ = server, = = peer, # = local clock. / .- Source state * = current synced, + = combined , - = not combined, | / ? = unreachable, x = time may be in error, ~ = time too variable. || .- 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 =============================================================================== ^* controller 9 6 177 46 +19us[ -65us] +/- 36ms ==>如果前面是有個*表明時間服務器可同步 常用的命令: 啟動chronyd進程 systemctl start chronyd.service 強制單次進行時間同步 chronyd -q server <時間服務器域名> iburst 或者 ntpdate <ntp_server_name> ## 查看 ntp服務器是否可以正常同步 ntpdate -d <ntp_server_name> ## 查看 ntp_servers 狀態 chronyc sources -v ## 查看 ntp_sync 狀態 chronyc sourcestats -v ## 查看 ntp_servers 是否在線 chronyc activity -v ## 查看 ntp 詳細信息 chronyc tracking -v 當執行ntpdate -d <ntp_server_name>出現 NTP. Server dropped: strata too high 可能原因是時間服務器stratum 值過高 調低就可以了 比如server為 8 client為9 則正常 當執行ntpdate -d <ntp_server_name>出現Server dropped: no data 可能原因是沒有reach到時間服務器的時間服務,沒有獲取到數據,需要重新獲取一次或多次數據

[原]CentOS 7 chrony 筆記