Configure NTP, synchronize server time, and configure ntp synchronization server
Configure NTP and synchronize server time
There are more and more servers in the project. Recently, Database Synchronization has been performed on several servers. When a synchronization error occurs, you can view the logs, as a result, we found a small problem that has been ignored-Time Inconsistency between several servers.
So I decided to use NTP (Network Time Protocol))--Is a protocol used to synchronize time between computers in the network. Its purpose is to synchronize the computer clock to the Coordinated Universal Time UTC, and its accuracy can reach 0.1 ms in the LAN. In most places on the Internet, its accuracy can reach 1-50 ms. To synchronize the time of several servers.
The idea is simple, that is, to make one of the servers into a time server, and then other servers can calibrate the time according to it. The following are the specific practices:
1. server settings:
By default, windows server 2008 works as an NTP client. Therefore, you must modify the Registry to run the system as an ntp server. Note: Before you work, back up the Registry file.
1. Enter the regedit command in the Start menu and open the registry settings screen. At this time, make sure to back up the Registry file.
2. Modify the key values of the following options
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ W32Time \ TimeProviders \
Enabled in NtpServer is set to 1 to enable the NTP server function.
3. Modify the following key values
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ W32Time \ Config \
AnnounceFlags is set to 5, which forces the host to declare itself as a reliable time source, using a built-in Complementary Metal Oxide Semiconductor (CMOS) clock.
4. Execute the following command on the doscommand line to ensure that the preceding modification takes effect.
Netstop w32time
Netstart w32time
It is recommended that you add the following configuration to avoid ntp synchronization between the server and the internet if the server is connected to the internet:
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ W32Time \ TimeProviders \
The enable value of NtpClient is set to 0 to prevent the client from automatically synchronizing external time services.
Ii. Customer settings:
1. Specify the master time server. Enter "net time/setsntp: ntp.sjtu.edu.cn" in DOS mode. Here we specify ntp.sjtu.edu.cn as the master time server or another address (210.72.145.44 ).
2. freely set the time interval: (you can skip this step)
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ W32Time \ TimeProviders \
NtpClient's "SpecialPollInterval" is set to 604800 (or 86400) by default)
3. Configure Synchronization
Click Update now, and the pc will show that the synchronization is successful.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.