In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to determine whether NTP is synchronized in Linux, for this problem, this article details the corresponding analysis and solution, hoping to help more small partners who want to solve this problem find a simpler and easier way.
NTP stands for Network Time Protocol, which synchronizes clocks between computer systems over the network. NTP servers keep all servers in an organization synchronized to execute time-based jobs at accurate times. NTP clients synchronize their clocks with NTP servers.
We have written an article about NTP server and client installation and configuration. If you would like to view these articles, please navigate to the links below.
How do I install and configure NTP servers and clients on Linux?
How do I install and configure Chrony as an NTP client?
I assume that you have set up an NTP server and NTP client using the links above. Now, how do I verify that NTP settings are working correctly?
There are three commands in Linux that can be used to verify NTP synchronization. Details are as follows. In this article, we'll show you how to verify NTP synchronization using all of these commands.
ntpq: ntpq is a standard NTP query program.
ntpstat: Displays the synchronization status of the network world.
timedatetl: It controls the system time and date in the systemd system.
Method 1: How do I check NTP status using the ntpq command?
The ntpq utility monitors the operation of the NTP daemon ntpd and determines performance.
The program can be run in interactive mode or controlled using command-line parameters. It prints out a list of connected peers by sending multiple queries to the server. If NTP works correctly, you will get output similar to the following.
# ntpq -p remote refid st t when poll reach delay offset jitter==============================================================================*CentOS7.2daygee 133.243.238.163 2 u 14 64 37 0.686 0.151 16.432
Details:
-p: Prints a list of peers known to the server and a summary of their status.
Method 2: How do I check NTP status using the ntpstat command?
ntpstat reports the synchronization status of the NTP daemon (ntpd) running on the local computer. If the local system is found to be synchronized with the reference time source, ntpstat reports approximate time accuracy.
The ntpstat command returns three status codes based on NTP synchronization status. Details are as follows.
0: Returns 0 if the clock is synchronized.
1: Returns 1 if the clock is out of sync.
2: Returns 2 if clock status is uncertain, e.g. ntpd is not reachable.
# ntpstat synchronised to NTP server (192.168.1.8) at stratum 3 time correct to within 508 ms polling server every 64 s Method 3: How do I check NTP status using the timedatetl command?
The timedatetl command queries and changes the system clock and its settings in the systemed system.
#timedatetl or #timedatetl status Local time: Thu 2019-05-30 05:01:05 CDT Universal time: Thu 2019-05-30 10:01:05 UTC RTC time: Thu 2019-05-30 10:01:05 Time zone: America/Chicago (CDT, -0500) NTP enabled: yesNTP synchronized: yes RTC in local TZ: no DST active: yes Last DST change: DST began at Sun 2019-03-10 01:59:59 CST Sun 2019-03-10 03:00:00 CDT Next DST change: DST ends (the clock jumps one hour backwards) at Sun 2019-11-03 01:59:59 CDT Sun 2019-11-03 01:00:00 CST More tips
Chrony is an NTP client replacement. It synchronizes the system clock faster and with higher time accuracy, and is especially useful for systems that are not always online.
Chronyd is smaller, it uses less memory and wakes up the CPU only when necessary, which saves power better. It works well even if the network is congested for a long time.
You can use any of the following commands to check Chrony status.
Check Chrony tracking status.
# chronyc tracking Reference ID : C0A80105 (CentOS7.2daygeek.com)Stratum : 3Ref time (UTC) : Thu Mar 28 05:57:27 2019System time : 0.000002545 seconds slow of NTP timeLast offset : +0.001194361 secondsRMS offset : 0.001194361 secondsFrequency : 1.650 ppm fastResidual freq : +184.101 ppmSkew : 2.962 ppmRoot delay : 0.107966967 secondsRoot dispersion : 1.060455322 secondsUpdate interval : 2.0 secondsLeap status : Normal
Run the sources command to display information about the current time source.
# chronyc sources 210 Number of sources = 1MS Name/IP address Stratum Poll Reach LastRx Last sample===============================================================================^* CentOS7.2daygeek.com 2 6 17 62 +36us[+1230us] +/- 1111ms The answer to how to determine whether NTP is synchronized in Linux is shared here. I hope the above content can be helpful to everyone. If you still have a lot of doubts, you can pay attention to the industry information channel for more relevant knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.