Secondarynamenode application excerpt

Source: Internet
Author: User

I. Environment

Hadoop 0.19.2, JDK 1.6, Linux operating system

Ii. Background

Last Friday, JDK encountered an inexplicable segment error due to operating system reasons. No matter whether you restart the machine or reinstall the JDK. Even worse, the faulty machine is the master. At that time, my heart was cool, because the secondarynamenode configuration was also on this machine (default, not changed ). Fortunately, this cluster is a test environment, so the problem is not big. For this reason, I reconfigured secondarynamenode to another machine, and conducted a test to disable and recover the namenode.

Iii. Operations

1. I have written a good article on secondarynamenode. Here I just want to talk about the key point. It is not the backup process of namenode. To put it bluntly, namenode is down. If secondarynamenode is not down, unfortunately, clusters cannot work normally. Here there is a document translation is very good, I link: http://blog.csdn.net/AE86_FC/archive/2010/02/03/5284181.aspx

2. secondarynamenode should not be with namenode in general. Therefore, I configured it on datanode. To configure datanode, you need to change the following configuration file. Conf/master, CONF/hdfs-site.xml, and CONF/core-site.xml are modified as follows:

MASTER: Generally, the installation manual writes the IP address or name of the namenode machine. It should be noted that this master does not decide which is namenode, but is determined by secondarynamenode (the key configuration for deciding who is namenode is the fs. Default. name parameter in the core-site.xml ). Therefore, enter the IP address or machine name of your datanode. One row.

Hdfs-site.xml: This configuration file needs to change 1 parameter:

Change 0.0.0.0 to your namenode IP address.

<Property>
<Name> DFS. http. address </Name>
<Value> 0.0.0.0: 50070 </value>
<Description>
The address and the base port where the DFS namenode web UI will listen on.
If the port is 0 then the server will start on a free port.
</Description>
</Property>

Core-site.xml: Here there are 2 parameters configurable, but in general we do not modify. FS. Checkpoint. period indicates how long the HDFS image is recorded. The default value is 1 hour. FS. Checkpoint. Size indicates the size of a record. The default value is 64 MB.

<Property>
<Name> fs. Checkpoint. period </Name>
<Value> 3600 </value>
<Description> the number of seconds between two periodic checkpoints.
</Description>
</Property>

<Property>
<Name> fs. Checkpoint. Size </Name>
<Value> 67108864 </value>
<Description> the size of the current edit log (in bytes) that triggers
A periodic checkpoint even if the fs. Checkpoint. Period hasn't expired.
</Description>
</Property>

3. Check the configuration. After the configuration is complete, we need to check whether the configuration is successful. You can check the file directory on the machine that runs secondarynamenode to determine whether the configuration is successful. Enter JPs to check whether the secondarynamenode process exists. If yes, check whether there are backup records in the corresponding directory. For example:

This directory usually exists in hadoop. tmp. DIR/dfs/namesecondary.

Iv. Recovery

1. How to restore after the configuration is complete. First, kill the namenode process and delete the data in the hadoop. tmp. dir directory. Manufacturing master failure.

2. Set the secondarynamenode node to hadoop. TMP. the DIR/dfs/namesecondary directory is copied to the hadoop directory on the namenode node. For example, if hadoop is installed in the/home/hadoop directory, the directory is/home/hadoop/namesecondary/

3. Delete all content in the DFS. Name. dir directory.

4. Modify the hadoop-site.xml configuration file and copy the copied namesecondary directory to the configuration parameter Fs. Checkpoint. dir

5. Use hadoop namenode-importcheckpoint when starting namenode

/Home/hadoop/bin/hadoop namenode-importcheckpoint

In this case, the system loads edites from the/home/hadoop/namesecondary directory.

(The black text part is based on the original text and is modified based on actual experience. Part 20110630 needle2)

V. Summary

1. You can configure multiple secondarynamenode files. You can write a few more files in the master file.

2. Remember to manually copy the data to the namenode machine to restore the data. It is not automatic (see the recovery operation written above ).

3. the backup cycle can be modified. If you do not want to back up an image once an hour, you can change the backup cycle to a short time. FS. Checkpoint. Period value in the core-site.xml.

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.