In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article to share with you is about how to set the system time in Linux, Xiaobian feel quite practical, so share to everyone to learn, I hope you can gain something after reading this article, not much to say, follow Xiaobian to see it.
I. Query system time:
Query system time: date
Query/Set Hardware Time:
hwclock -r Displays hardware clock and date
hwclock -s adjusts the system clock to match the current hardware clock.
hwclock -w Adjust hardware clock to match current system clock
II. Synchronization time
You can use the ntpdate command or the ntpd service.
ntpdate:
Using ntpdate is easier. Format:
[root@linux ~]#ntpdate 192.168.0.2
[root@linux ~]#ntpdate time.ntp.org
Exchange Rate Calculationhttp://www.gendan5.com/exrate.html
However, such synchronization is only mandatory to set the system time to ntp server time. If there is a problem with the CPU tick, it is only a temporary solution. Therefore, it is generally coordinated with cron command to perform periodic synchronization settings. For example, add to crontab:
0 12 * * * * /usr/sbin/ntpdate192.168.0.1
This will synchronize time once a day at 12:00 sharp. The ntp server is 192.168.0.1.
ntpd service
Using ntpd is better than using ntpdate plus cron. Because, ntpdate synchronization time, will cause time jump, some time-dependent programs and services will have an impact. Sleep, timer, etc. Moreover, ntpd service can correct cpu tick as well as time. Ideally, use ntpdate to force time synchronization at boot and ntpd to synchronize time at other times.
NTP client synchronization interval
How often does the NTP service want the clock server to request a clock synchronization? The default minimum interval is 64s and the default maximum interval is 1024s (approximately 17 minutes). 64s is reasonable, and the default interval is adjustable
IV. Tolerance error range of ntpd
Note that ntpd has a self-protection setting: if the local time differs too much from the source time (>1000s), the NTP service will assume that the clock has been adjusted artificially or that there has been a hardware failure, such as a damaged CMOS battery. At this point, NTP service will exit, requiring manual (ntpdate …) clock synchronization. So the newly set time server must first ntpdate get the initial time value from the source, and then start the ntpd service. after ntpd service runs, it first synchronizes with the source server once every 64 seconds, adjusts its own time step by step according to the error value measured during each synchronization through complex calculation, and gradually increases the synchronization interval as the error decreases. This adjustment process repeats itself with each jump.
The above is how to set the system time in Linux, Xiaobian believes that some knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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: 203
*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.