扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
小编给大家分享一下hadoop如何根据SecondaryNameNode恢复Namenode ,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
专注于为中小企业提供成都网站设计、做网站服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业合阳免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了近千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
制造namenode宕机的情况
1) kill 掉namenode的进程
[hadoop@hadoop bin]$ kill -9 13481
2)删除dfs.name.dir所指向的文件夹,这里是/home/hadoop/hdfs/name.
current image in_use.lock previous.checkpoint [hadoop@hadoop name]$ rm -rf *
删除name目录下的所有内容,但是必须保证name这个目录是存在的
3)从secondarynamenode元数据 namesecondary 目录下复制 到namenode name目录下
我的secodarynamenode 元数据目录
/home/hadoop/tmp/dfs/namesecondary
复制过程
[hadoop@hadoop name]$ cp -R /home/hadoop/tmp/dfs/namesecondary/* .
4)启动namenode
[hadoop@hadoop bin]$ ./hadoop-daemon.sh start namenode
5)检查
使用hadoop fsck /user命令检查文件Block的完整性
[hadoop@hadoop bin]$ hadoop fsck / Warning: $HADOOP_HOME is deprecated. FSCK started by hadoop from /192.168.0.101 for path / at Sun Dec 22 23:04:31 CST 2013 ................................... /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310222119_0001/job.jar: Under replicated blk_-8571652065964704775_1020. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310222119_0002/job.jar: Under replicated blk_-5947701456602696019_1021. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310222119_0003/job.jar: Under replicated blk_8214183112681524571_1022. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310222142_0001/job.jar: Under replicated blk_4805420250921446015_1024. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310222142_0002/job.jar: Under replicated blk_7913185784171356584_1027. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310222142_0004/job.jar: Under replicated blk_-8411847042533891069_1035. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310222142_0005/job.jar: Under replicated blk_2163772543235273521_1036. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310222142_0007/job.jar: Under replicated blk_-3491660194168043022_1044. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310242056_0002/job.jar: Under replicated blk_5280511346594851641_1270. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310242056_0003/job.jar: Under replicated blk_5588149584508213931_1271. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310242056_0004/job.jar: Under replicated blk_-1846184614352398688_1272. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310242056_0005/job.jar: Under replicated blk_8253537375261552577_1273. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310242100_0001/job.jar: Under replicated blk_-6858089306760733073_1275. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310242100_0002/job.jar: Under replicated blk_-630176777256891004_1276. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310242100_0003/job.jar: Under replicated blk_3453389521553623867_1277. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310242100_0004/job.jar: Under replicated blk_-4262000880964323956_1278. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310242105_0001/job.jar: Under replicated blk_-5324801167724976561_1280. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310242105_0002/job.jar: Under replicated blk_3284342834321881345_1281. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310242105_0004/job.jar: Under replicated blk_5174401550469241860_1295. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310242105_0009/job.jar: Under replicated blk_6390129220783606015_1327. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201310242105_0010/job.jar: Under replicated blk_8995477665353821346_1328. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201311292212_0007/job.jar: Under replicated blk_-6447241034801532571_1699. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201312082210_0001/job.jar: Under replicated blk_-187920261151639503_1741. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201312082210_0002/job.jar: Under replicated blk_1912732980088631445_1742. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/staging/hadoop/.staging/job_201312092348_0001/job.jar: Under replicated blk_448639237400606735_1953. Target Replicas is 10 but found 1 replica(s). . /home/hadoop/tmp/mapred/system/jobtracker.info: CORRUPT block blk_-4973841422235657473 /home/hadoop/tmp/mapred/system/jobtracker.info: MISSING 1 blocks of total size 4 B.Status: CORRUPT Total size: 367257 B Total dirs: 83 Total files: 60 Total blocks (validated): 57 (avg. block size 6443 B) ******************************** CORRUPT FILES: 1 MISSING BLOCKS: 1 MISSING SIZE: 4 B CORRUPT BLOCKS: 1 ******************************** Minimally replicated blocks: 56 (98.24561 %) Over-replicated blocks: 0 (0.0 %) Under-replicated blocks: 25 (43.85965 %) Mis-replicated blocks: 0 (0.0 %) Default replication factor: 1 Average block replication: 0.98245615 Corrupt blocks: 1 Missing replicas: 225 (401.7857 %) Number of data-nodes: 1 Number of racks: 1 FSCK ended at Sun Dec 22 23:04:31 CST 2013 in 89 milliseconds
恢复工作完成,检查hdfs的数据
以上是“hadoop如何根据SecondaryNameNode恢复Namenode ”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流