Time synchronization between multiple CentOS servers (NTP time synchronization)

Source: Internet
Author: User

When a program runs on multiple servers, the clock on these servers is sometimes the same. However, when the server runs for a certain period of time, the clock on each server may be different, in this case, all servers need to automatically calibrate their respective clocks.

NTP is a convenient clock service, which can be used for clock synchronization.

(The following solutions apply to local networks that do not connect to the Internet. The requirement is to synchronize all server clocks .)

1. select one of the servers as the benchmark server to provide the clock service.

(1) first, check whether ntp exists. If it does not exist, run the following command to install it:

Yum install ntp

(2) modify the configuration file/etc/ntp. conf and insert:

Restrict 192.168.20.0 mask 255.255.255.0 nomodify notrap

Where:

Use restrict to control permissions
Nomodify-the user end cannot change the time parameter of the ntp server
Noquery-the user end cannot use commands such as ntpq and ntpc to query the ntp server
Notrap-remote trap login not provided

(3) at this time, you can provide the time service to the machine 192.168.20.0/24. Enable the ntp service:

/Etc/rc. d/init. d/ntp start // start the ntp service <br/> chkconfig ntpd on // start the ntp service

(4) check whether the ntp port is Enabled:

Netstat-unlnp

If it is normal, you can see that port 123 is enabled.

2. Client synchronization (using ntpd service)

You can also use ntpdate for manual synchronization, but I recommend using the ntpd service for automatic synchronization here, for more information, see: http://hi.baidu.com/seeseeabc/blog/item/0df2136746fd5c2eaa184c62.html

(1) Modify/etc/ntp. conf and insert:

Server 192.168.255.91

(2) Enable ntpd service to start

Chkconfig ntpd on

(3) Start the client ntpd service

/Etc/rc. d/init. d/ntpd start 

Reference: http://hi.baidu.com/seeseeabc/blog/item/0df2136746fd5c2eaa184c62.html

Related Article

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.