分享

hadoop 根据SecondaryNameNode恢复Namenode

lzw 2013-12-22 23:05:31 发表于 总结型 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 0 33435
制造namenode宕机的情况
1) kill 掉namenode的进程
  1. [hadoop@hadoop bin]$ kill -9 13481
复制代码
2)删除dfs.name.dir所指向的文件夹,这里是/home/hadoop/hdfs/name.
  1. current  image  in_use.lock  previous.checkpoint
  2. [hadoop@hadoop name]$ rm -rf *
复制代码
删除name目录下的所有内容,但是必须保证name这个目录是存在的
3)从secondarynamenode元数据namesecondary目录下复制到namenode name目录下
我的secodarynamenode 元数据目录
  1. /home/hadoop/tmp/dfs/namesecondary
复制代码
复制过程
  1. [hadoop@hadoop name]$ cp -R /home/hadoop/tmp/dfs/namesecondary/* .
复制代码
4)启动namenode
  1. [hadoop@hadoop bin]$ ./hadoop-daemon.sh start namenode
复制代码
5)检查
使用hadoop fsck /user命令检查文件Block的完整性

  1. <font size="2">[hadoop@hadoop bin]$ hadoop fsck /</font>
  2. Warning: $HADOOP_HOME is deprecated.
  3. FSCK started by hadoop from /192.168.0.101 for path / at Sun Dec 22 23:04:31 CST 2013
  4. ...................................
  5. /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).
  6. .
  7. /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).
  8. .
  9. /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).
  10. .
  11. /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).
  12. .
  13. /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).
  14. .
  15. /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).
  16. .
  17. /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).
  18. .
  19. /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).
  20. .
  21. /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).
  22. .
  23. /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).
  24. .
  25. /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).
  26. .
  27. /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).
  28. .
  29. /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).
  30. .
  31. /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).
  32. .
  33. /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).
  34. .
  35. /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).
  36. .
  37. /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).
  38. .
  39. /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).
  40. .
  41. /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).
  42. .
  43. /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).
  44. .
  45. /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).
  46. .
  47. /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).
  48. .
  49. /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).
  50. .
  51. /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).
  52. .
  53. /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).
  54. .
  55. /home/hadoop/tmp/mapred/system/jobtracker.info: CORRUPT block blk_-4973841422235657473
  56. /home/hadoop/tmp/mapred/system/jobtracker.info: MISSING 1 blocks of total size 4 B.Status: CORRUPT
  57. Total size:        367257 B
  58. Total dirs:        83
  59. Total files:        60
  60. Total blocks (validated):        57 (avg. block size 6443 B)
  61.   ********************************
  62.   CORRUPT FILES:        1
  63.   MISSING BLOCKS:        1
  64.   MISSING SIZE:                4 B
  65.   CORRUPT BLOCKS:         1
  66.   ********************************
  67. Minimally replicated blocks:        56 (98.24561 %)
  68. Over-replicated blocks:        0 (0.0 %)
  69. Under-replicated blocks:        25 (43.85965 %)
  70. Mis-replicated blocks:                0 (0.0 %)
  71. Default replication factor:        1
  72. Average block replication:        0.98245615
  73. Corrupt blocks:                1
  74. Missing replicas:                225 (401.7857 %)
  75. Number of data-nodes:                1
  76. Number of racks:                1
  77. FSCK ended at Sun Dec 22 23:04:31 CST 2013 in 89 milliseconds
复制代码
恢复工作完成,检查hdfs的数据








欢迎加入about云群9037177932227315139327136 ,云计算爱好者群,亦可关注about云腾讯认证空间||关注本站微信

没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条