scenario hadoop2.2
assume everything is ready excepte hadoop2.2.
1) install hadoop namenode
cmd>msiexec /qb /i "hdp-win-2.0.6.msi" /lv "hdp.log" HDP_LAYOUT="D:\config\clusterproperties.txt" HDP_DIR="D:\hdp\hadoop" HDP_USER_PASSWORD="Mar19@Updat" DESTROY_DATA="no"
2) format namenode
cmd>hdfs namenode -format
3) delete current foulder (all namenode edit files) in "D:\hdpdata\hdfs\nn" and copy checkpoint folder "current" from secondary namenode(maybe d:\hdpdata\hdfs\snn) to primary namenode(d:\hdpdata\hdfs\snn )
4) Restore from checkpoint dir
Run cmd.exe by user hadoop ( or some users have full permission )
Runas /user:hadoop cmd.exe
You must have user hadoop password.
Use this command to start hadoop service and import checkpoint from checkpoint dir
cmd>%hadoop_home%/bin/hdfs namenode -importcheckpoint
Use ctrl+C to stop service which is completed. and Delete your namenode's checkpoint dir (dfs.namenode.checkpoint.dir the same as secondary namenode)
Start service by this command:
cmd>start_local_hdp_services.cmd
Levae safemode
cmd>%hadoop_home%/bin/hdfs dfsadmin -safemode leave
Balance you HDFS:
cmd>%hadoop_home%/bin/hdfs balancer -threshold 5
5. Confirm your Hadoop service is restored successfully.
Open URL http://namenode:50070/ to check if there are some missing block. If yes. Please kindly check where they are and what they are.
Because restore from secondary namenode isn't a real time restore solution. It may lost the last time what you do in the jobtracker. It doesn't matter. Just delete them.