restore hadoop primary namenode from secondary namenode checkpoint step by step

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.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值