How to use the NTP service in Linux to manage/synchronize server time _ PHP Tutorial

Source: Internet
Author: User
Use the NTP service in Linux to manage the synchronization server time. In Linux, the NTP service is used to manage the synchronization server time. when multiple webservers exist and the time of each server needs to be consistent, you can consider using the NTP service. 1. use the NTP service in Linux to manage and synchronize server time.
When there are multiple Web servers and the time of each Server must be consistent, you can consider using the NTP service.
1. use ntpstat to check the current state of the NTP service.
# Ntpstat
If the following content is output, it indicates that the NTP service has not been started. you need to set the NTP service to start automatically when the server is restarted:
Unable to talk to NTP daemon. Is it running?
If the following content is output, it indicates that the job is already in progress:
Synchronised to NTP server (198.55.111.5) at stratum 3
Time correct to within 238 MS
Polling server every 64 s
If the output is unsynchronised, you need to restart (ntpd restart) for synchronization.
2. use ntpq-p to view the NTP server list
# Ntpq-p
Remote refid st t when poll reach delay offset jitter
========================================================== ==============================================
* Dns1.synet.edu. 202.118.1.46 2 u 46 64 377 19.924 11.896
+ Dns2.synet.edu. 202.118.1.46 2 u 45 64 317 20.518 11.833
Dns.sjtu.edu.cn. STEP. 16 u-64 0 0.000 0.000 0.000
3. Manual synchronization time
# Ntpdate
If the following content is output, it indicates that the ntp service has been started and the Manual synchronization time has failed. you need to stop the ntp service first:
The NTP socket is in use. exiting
# Service ntpd stop
# Ntpdatecn.pool.ntp.org
If the following content is output, the Manual synchronization time is successful:
Adjust time server xxx
Finally, remember to start the ntp service and let it automatically update.
4. start the NTP service
# Service ntpd start
Starting ntpd: [OK]
Enable NTP to start at boot time with the chkconfig command.
5. enable NTP auto-start
# Chkconfig ntpd on
Verify that NTP is enabled with the following command.
6. check NTP auto-start status
# Chkconfig -- list ntpd
Ntpd 0: off1: off2: on3: on4: on5: on6: off
Here ntpd is on in runlevels 2, 3, 4, and 5, which is correct.
7. Custom NTP server
Refer to here.


When there are multiple Web servers, and the time of each Server must be consistent, you can consider using the NTP service. 1. first use...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.