Configuration of the NTP server

Source: Internet
Author: User

When installing Cloudera CDH, it is required to install the NTP server to implement the time synchronization problem between different hosts. The following is a detailed introduction to the NTP installation process.

First, the server-side configuration

1, first install NTP server, installation of a lot of ways, you can choose Rpm,tar can also choose Yum Online installation. So what I'm choosing here is an online installation.

Execute the Yum install NTP

2. View the version of NTP that is installed

Rpm-qa |grep NTP results as shown:

3. Modify the ntp.conf configuration file

Vi/etc/ntp.conf This document focuses on two places

(1) Set the IP address or IP segment of the client host that is allowed to synchronize

For example: Restrict 192.168.120.0 mask 255.255.255.0 nomodify represents a host that allows 192.168.120.1--192.168.120.255 IP addresses to be synchronized with the server.

(2) Set up a server that is synchronized on the previous layer

Server 2.rhel.pool.ntp.org (default time server)

Finally, the file is modified in the following form:

# For more information on this file, see the Man pages# ntp.conf (5), NTP_ACC (5), Ntp_auth (5), Ntp_clock (5), Ntp_misc (5)  , Ntp_mon (5). driftfile/var/lib/ntp/drift# Permit time synchronization with our time source, but do not# Permit the source  To query or modify the service in this system.restrict default Kod nomodify restrict-6 default kod nomodify # Permit All  Access over the loopback interface. This could# is tightened as well, but to does so would effect some of# the administrative functions.restrict 127.0.0.1 restr Ict-6:: 1restrict 192.168.120.0 Mask 255.255.255.0 nomodify//Place to note here# Hosts on local network is less restricted. #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap# use public servers From the pool.ntp.org project.# consider joining the pool (http://www.pool.ntp.org/join.html). Server s1a.time.edu . CN prefer//Here is a place to be aware ofServer S1b.time.edu.cnserver s1c.time.edu.cn#broadcast 192.168.1.255 autokey# broadcast server#broadcastclient# Broadcast client#broadcast 224.0.1.1 autokey# multicast server#multicastclient 224.0.1.1# multicast client# Manycastserver 239.255.254.254# manycast server#manycastclient 239.255.254.254 autokey # manycast client# Enable public k EY cryptography. #cryptoincludefile/etc/ntp/crypto/pw# key file containing the keys and key identifiers used when Operatin g# with symmetric key cryptography. keys/etc/ntp/keys# Specify the key identifiers which is trusted. #trustedkey 4 8 42# Specify the key identifier to use WI Th the NTPDC utility. #requestkey 8# Specify the key identifier to use with the NTPQ utility. #controlkey 8# Enable Writing of statistics records. #statistics clockstats cryptostats loopstats peerstats

4. Start ntpd with daemon process

Execute ntpd-c/etc/ntp.conf-p/tmp/ntpd.pid

NTPD start

Ps-ef|grep ntpd

After you start the NTP service on an NTP server, the NTP server itself or the synchronization with its server takes a period of time, which can be 5 minutes, resulting in no server suitable when the client runs the ntpdate command for synchronization For synchronization found error.

So how do you know when NTP server has completed the process of synchronizing itself?

To use the command on an NTP server:

Watch Ntpq-p

The following screen appears:

  

Second, configure the time synchronization client

(1) Vi/var/spool/cron/root (or CRONTAB-E) add the following line to the file:

*/30 * * * * * Root/usr/sbin/ntpdate 192.168.120.231 represents the time to update the server 192.168.120.231 every 30 minutes.

(2) # Set the scheduled task to Automatic, default is the "optional" start
Chkconfig Crond on

(3) Start the Scheduled Tasks service
Service Crond Restart

Configuration of the NTP server

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.