hadoop1.0.4 upgrade to hadoop2.2 detailed process steps

Source: Internet
Author: User
Tags safe mode zookeeper
hadoop1.x Upgrade to hadoop2.2
This article refers to the blog: http://blog.csdn.net/ajax_jquery/article/details/27311671, some places have been modified, and detailed description of the HDFS upgrade, is the key to upgrading the Hadoop cluster to 2.0, while the HDFS upgrade, most importantly the Namenode upgrade.
First of all: hadoop1.x can not directly upgrade to HA mode, Namenode can not be upgraded successfully, here also with the help of hadoop2.x-compatible hadoop1.x configuration file to upgrade.
The following error may occur if you upgrade hadoop2.x ha mode directly
FATAL org.apache.hadoop.hdfs.server.namenode.NameNode:Exception in Namenode join
Org.apache.hadoop.HadoopIllegalArgumentException:Invalid startup option. Cannot perform DFS upgrade with HA enabled
The following is the process of upgrading hadoop2.x ha mode, specifically why HA instead of using ha+federation, not the problem here to say
Upgrade the Namenode metadata in hadoop1.x mode first:
Step 1: Do the next savenamespace operation, stop the cluster, and back up the Metadata under HDFS, operate as follows:
1.1 Namenode enters Safe mode state
$ Bin/hadoop Dfsadmin-safemode Enter
1.2 Performing Savenamespace operations
$ bin/hadoop Dfsadmin-savenamespace
1.3 Leaving Safe Mode
$ bin/hadoop Dfsadmin-safemode Leave
1.4 Stop Cluster
1.5 backup Dfs.name.dir The following meta data
Cp-r name/data/zhoulei/bak.name.20140916
Step2:
2.1 Replace the Hadoop environment in the cluster with 2.2 (note: This is a configuration file that must be selected in hadoop1.x in/conf/. Otherwise it will report the above error), perform the following upgrade Namenode command:
hadoop-daemon.sh Start Namenode-upgrade
Step3:
After the Namenode upgrade is complete, Datanode is started and Datanode is automatically upgraded to the same version as Namenode
hadoop-daemons.sh start Datanode At this point, to start all the datanode, otherwise there will not be much problem, but the other nodes of the Datanode will not automatically upgrade.
3.1 Shutting down the cluster
sbin/stop-dfs.sh
3.2 Configuring the configuration file to be upgraded to 2
Replace the configuration file with the hadoop2.2 configuration file at this point
3.3 To upgrade the Namenode metadata some parameters are modified to ha mode:
You need to change the parameters of the version file of the Journalnode meta-file to the same as the Namenode metadata or use the command:
I, first start journalnode:sbin/hadoop-daemon.sh start journalnode at this time to note that all the journalnode to start or the following steps error
II. Install Journalnode shared directory for Namenode Bin/hdfs namenode-initializesharededits,
If the previous step does not start all, the following error occurs
14/09/17 10:13:06 ERROR Namenode. Namenode:could not initialize GKFX edits dirorg.apache.hadoop.hdfs.qjournal.client.QuorumException:Unable to check If JNs is ready for formatting. 1 Successful responses III, start namenode:sbin/hadoop-daemon.sh start Namenode
IV, start datanode:sbin/hadoop-daemons.sh start datanode start all datanode nodes, or start each node individually
Note that there is no difference between active namenode or standby nodes, only one node.
3.4 Copy the contents of the active Namenode {Dfs.namenode.name.dir} directory to the {Dfs.namenode.name.dir} directory of standby Namenode and start standby Namenode
or use the command:
Execution of Bin/hdfs Namenode-bootstrapstandby under another Namenode node is similar to the direct copy meta-data
3.5 Format ZK (can be executed on HADOOP01): Bin/hdfs Zkfc-formatzk
3.6 Restart the hdfs:sbin/start-dfs.sh (be sure to restart, otherwise two namenode will be present and the state of standby)
At this point, even if you restart DFS but the two namnode are standby, this is because ZKFC does not start, we need to do two actions at this time
1) Start Quorumpeermain for each zookeeper node, respectively
zookeeper-3.4.5/bin/zkserver.sh start
2) Start ZKFC on the master node (not necessarily the primary node)
sbin/hadoop-daemon.sh Start ZKFC
At this point, look at the status of the two Namenode daemon will appear an active, a standby state.

3.7 After the upgrade, Namenode and datanode the ${dfs.data.dir}/directory will be a more folder previous/, which is the backup of the data before the upgrade.
If you determine that the upgrade was successful, you can use: Bin/hadoop Dfsadmin-finalizeupgrade (to be performed on active Namenode) Final commit upgrade

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.