Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Synchronization of hadoop Cluster time

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly talks about "synchronization of hadoop cluster time". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "hadoop Cluster time synchronization".

Test the cluster node:

192.168.10.1 master

192.168.10.2 slave01

1)。 Operate on the master time server:

Check that the ntp service is installed:

[root@master ~] # rpm-Q ntpntp-4.2.2p1-15.el5.centos.1 / / this indicates that it has been installed, if not installed, it is blank here.

If there is no installation, let's install it and mount the CD to install it.

(configure local yum source https://my.oschina.net/amui/blog/841567)

[root@master ~] # yum install ntp

Install the ntp server on each machine. After completion, you need to configure the NTP service to start itself.

[root@master ~] # chkconfig ntpd on

2)。 Configure the primary server ntp service configuration

Modify the configuration file ntp.conf:

[root@master ~] # vi / etc/ntp.conf# add client running synchronization time # only allow clients of network segment 192.168.10.0 to synchronize restrict 192.168.10.0 mask 255.255.255.0 nomodify notrap if the external time service is not available, use local time as the time service server 127.127.1.0 # local lockfudge 127.127.1.0 stratum 8

Configuration file modification completed, save exit, start the service.

3)。 Start the time server

[root@master ~] # service ntpd start [or / sbin/service ntpd start] [root@master ~] # chkconfig ntpd on # set ntp server self-startup # service ntpd start

After startup, it usually takes about 5-10 minutes to start synchronizing time with the external time server. You can query the NTPD service through the command.

4)。 View service connections and snooping

[root@master hadoop] # netstat-tlunp | grep ntpudp 0 0192.168.10.1 tlunp 123 0.0.0.0 3479/ntpdudp 0 0127.0.0.1 tlunp 123 0.0.0.0 * 3479/ntpdudp 000. 0.0.0 3479/ntpdudp 123 0.0.0.0 3479/ntpdudp * 3479/ntpdudp 00 fe80::a00:27ff:fe58:e20:123: * 3479/ntpdudp 0 0: 123: * 3479/ntpd

The appearance of 192.168.10.1VR 123 indicates that the connection and monitoring are correct, using UDP mode.

5)。 Client synchronization configuration

Run the following command on each other slave node

# ntpdate master (or ntpdate 192.168.10.1)

[root@slave01 ~] # ntpdate master

At this time, it is found that the time between nodes is synchronized, but ntpdate is only running when it is powered on. If we want to set it to synchronize once every minute.

Use crontab to update the time automatically after installation:

Synchronize every 1 minute:

[root@slave01] # crontab-e

Enter:

* / 1 * / usr/sbin/ntpdate 192.168.10.1

=

The following is the format of crontab: commands to be run in time-sharing, day, month and week

That is:

Column 1 minutes 1: 59

Column 2 hours 1: 23 (0 means midnight)

The third day 1: 31

The fourth lunar month 1: 12

The fifth column is 0006 (0 means Sunday)

Column 6 commands to run

Here are some examples of crontab file entries:

30 21 * / usr/local/apache/bin/apachectl restart

The above example shows that apache is restarted at 21:30 every night

* * / 1 * / usr/local/apache/bin/apachectl restart

Restart apache every hour

* 23-7bat 1 * / usr/local/apache/bin/apachectl restart

Restart apache every other hour between 11:00 and 7 a.m.

=

6)。 test

Host: date view current time

Client: set an exception time at 11:11:11 for date-s

Ntpdate 192.168.10.1 for synchronization

Client date checks whether the time is the same as that of the host

At this point, I believe you have a deeper understanding of "hadoop cluster time synchronization". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report