In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to synchronize Linux time with internet time, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
When using linux (virtual machine), I often find that the linux time is not the same as that of my host (real machine) after using it for a certain period of time, and the host time is indeed internet time, and the time zone selected when installing linux is Asia/Shanghai.
First, install NTP [root @ server-2 ~] # yum install-y ntpdate 2, synchronization time / / method 1, use domain name connection, it needs to be parsed by DNS, and the speed is slow. [root@server-2 ~] # ntpdate pool.ntp.org// mode 2. Use IP to connect, super fast. [root@server-2] # ntpdate 120.24.81.91
Http://www.pool.ntp.org is the official website of NTP, on which we can find NTP Server cn.pool.ntp.org from our country. It has three server addresses: server 1: 1.cn.pool.ntp.org server 2: 2.asia.pool.ntp.org server 3: 3.asia.pool.ntp.org (sometimes there is a problem with using domain names directly, you can first Ping out their IP, and then synchronize with the IP address)
/ / the following message indicates success
Feb 21:23:06 ntpdate [62910]: step time server 182.92.12.11 offset-40.589470 sec 3. Write system time to system hardware to avoid restarting server time override
/ / display hardwareclock system hardware time
[root@server-2 ~] # hwclock
/ / write the system time to the system hardware
[root@server-2] # hwclock-w 4. Set the synchronization network time for scheduled tasks.
The crontab format is as follows:
# For details see man 4 crontabs# Example of job definition:#.-minute (0-59) # |.-hour (0-23) # | |.-day of month (1-31) # |.-month (1-12) OR jan,feb,mar Apr... # |.-day of week (0-6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat# | # * command to be executed
There are two ways to set up crontab scheduling tasks:
1. Write it in / etc/crontab
Code:
11 * root ntpdate 210.72.145.44
11:00 every day is synchronized with the China National time Service Center at 11:00 every day, of course, the premise is that
Apt-get install ntpdate
The code is also
11 * root ntpdate us.pool.ntp.org
2. Use the command crontab-e
Crontab-e 10 5 * root ntpdate us.pool.ntp.org;hwclock-w
In this way, the time of network calibration is automatically carried out at 5:10 every day, and the time of BIOS is updated at the same time.
The above is all the contents of the article "how to synchronize Linux time with internet time". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to 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: 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.