Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Recovering namenode from secondarynamenode

======================================================================
Recovering namenode by start from another machine
======================================================================
-----------------------------------------------------------------------------------------------------------1. Stop the cluster to make sure all data-nodes and job/task-tracker are down.
(Eg, bin/stop-all.sh)
-----------------------------------------------------------------------------------------------------------2. Select a node where you will run a new name-node, and set it up as usually for the name-node.
--------------------------------------------------------------------------------------------- --------------3. Format the new name-node.
(Eg, bin/hadoop namenode -format)
-----------------------------------------------------------------------------------------------------------4. cd <dfs.name.dir>/current
-----------------------------------------------------------------------------------------------------------5. You will see file VERSION in there. You will need to provide namespaceID of the old cluster in it.
-----------------------------------------------------------------------------------------------------------6. The old namespaceID could be obtained from one of the data-nodes.
--------------------------------------------------------------------------------------------------------7. just copy it from <dfs.data.dir>/current/VERSION.namespaceID
--------------------------------------------------------------------------------------------------------8. In the New machine(Namenode) rm <dfs.name.dir>/current/fsimage
(Eg, rm -r /hadoop/hdfs/current/fsimage)
--------------------------------------------------------------------------------------------------------9. In the namenode scp <secondary-node>:<fs.checkpoint.dir>/fsimage ./fsimage
(Eg, scp /hadoop/snn/checkpoint/current/fsimage NewNamenode:/hadoop/hdfs/name/current/)
--------------------------------------------------------------------------------------------------------10. Start the cluster. Upgrade is recommended, so that you could rollback if something goes wrong.
(Eg, bin/hadoop namenode -upgrade)
--------------------------------------------------------------------------------------------------------11. Run fsck, and remove files with missing blocks if any

You might also like