Configure the NTP service for a Ubuntu Cluster

Source: Internet
Author: User
1. Overview

Network Time Protocol (NTP) is a protocol used to synchronize computer time. It can synchronize computers with their servers or clock sources (such as quartzels and GPS, it provides high-precision time correction (the difference between the LAN and the standard is less than 1 millisecond, And the Wan is dozens of milliseconds), and supports encrypted validation to prevent malicious protocol attacks. (From Baidu encyclopedia)

2. Cluster status

Now, select one of the four Ubuntu hosts as the server that provides the NTP service (server01 ).

3. Install the NTP service

Install ntpserver on the host that provides the NTP service:

apt-get install ntp
4. Configure NTP service parameters
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for helpdriftfile /var/lib/ntp/ntp.drift# Enable this if you want statistics to be logged.#statsdir /var/log/ntpstats/statistics loopstats peerstats clockstatsfilegen loopstats file loopstats type day enablefilegen peerstats file peerstats type day enablefilegen clockstats file clockstats type day enable# Specify one or more NTP servers.# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for# more information.#server 0.ubuntu.pool.ntp.org#server 1.ubuntu.pool.ntp.org#server 2.ubuntu.pool.ntp.org#server 3.ubuntu.pool.ntp.org# Use Ubuntu‘s ntp server as a fallback.#server ntp.ubuntu.comserver 127.127.1.0 minpoll 4 maxpoll 5fudge 127.127.1.0 stratum 2# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for# details.  The web page 5. Test the NTP service.

Run the following command on the server that provides the NTP service:

ntpdate -q 127.0.0.1

Expected result:

server 127.0.0.1, stratum 3, offset -0.000018, delay 0.02568 2 Sep 16:11:07 ntpdate[5882]: adjust time server 127.0.0.1 offset -0.000018 sec

It indicates that the startup is normal.

6. Other hosts use it to synchronize time

Run the following command on the host whose synchronization time is required:

ntpdate server01

The result is as follows:

2 Sep 15:53:12 ntpdate[8420]: adjust time server 192.168.1.154 offset 0.497131 sec

Server01 can be either a host name or an IP address.

7. Set the scheduled synchronization time

Use crontab:

crontab -e

Set calibration once per hour:

* */1 * * * /usr/sbin/ntpdate server01

 

Configure the NTP service for a Ubuntu Cluster

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.