In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on how to quickly get accurate server time in a CentOS distribution. In general, if your user is installing CentOS in a desktop environment, it is easiest to configure your computer to synchronize its clock through a remote server through the enable Network time Protocol feature of GUI.
However, sometimes the above features do not work as expected. Then we can set the exact server time from the command line.
The following is assumed to be the operation of the root user. If it is not a user with root permission, then falsely add the sudo command to obtain the root permission.
You can do this using the ntp and ntpdate command-line utilities, which set the system date and time through NTP. If this package is not installed on your system, run the following command to install it:
# yum install ntp ntpdate
After installing the package, start and enable the ntpd service and view its status as shown below.
# systemctl start ntpd# systemctl enable ntpd# systemctl status ntpd
Then run the following ntpdate command to add the specified CentOS NTP server. Here, the-u option tells ntpdate to output packets using an unprivileged port, and the-s option enables logging output to the system syslog tool from standard output (the default).
# ntpdate-u-s 0.centos.pool.ntp.org 1.centos.pool.ntp.org 2.centos.pool.ntp.org
Next, restart the ntpd daemon to synchronize the CentOS NTP server date and time with the local date and time.
# systemctl restart ntpd
Now use the timedatectl command to check that NTP synchronization is enabled and that it is actually synchronized.
# timedatectl
Finally, using the hwclock utility, use the-w option below to set the hardware clock to the current system time.
# hwclock-w
More detailed documentation can be found in the man pages of ntpdate and hwclock.
# man ntpdate# man hwclock
If you are worried about an exception in the NTP service, you can specify a specific log output (edit / etc/ntp.conf configuration file):
Logfile / var/log/ntp.log
NTP is the Network time Protocol (Network Time Protocol), which is used to synchronize the time of network devices (such as computers, mobile phones, etc.).
The commonly used NTP servers in China are:
Cn.pool.ntp.org
Windows system comes with: time.windows.com and time.nist.gov
MacOS X system comes with: time.apple.com and time.asia.apple.com
Cn.ntp.org.cn
Ali Cloud NTP server: ntp1.aliyun.com, ntp2.aliyun.com, ntp3.aliyun.com, ntp4.aliyun.com, ntp5.aliyun.com, ntp6.aliyun.com, ntp7.aliyun.com
Tencent Cloud NTP server: ntpupdate.tencentyun.com
Server of National time Service Center: 210.72.145.44
NTP server of Tsinghua University: s1b.time.edu.cn, s1e.time.edu.cn, s2a.time.edu.cn, s2b.time.edu.cn
The above CentOS set accurate time method is the editor to share with you all the content, I hope to give you a reference, but also hope that you support more.
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.