Hadoop 报错be replicated to 0 nodes, instead of 1

1,现象:flume再往Hadoop HDFS写文件时flume.log报错 be replicated to 0 nodes, instead of 1

2012-12-18 13:47:24,673 WARN hdfs.BucketWriter: Caught IOException writing to HDFSWriter (java.io.IOException: File /logdata/20121218/bj4aweb04/8001_4A_ACA/8001_4A_ACA.1355799411582.tmp could only be replicated to 0 nodes, instead of 1
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:1558)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.addBlock(NameNode.java:696)

2,查看相关进程状态 datanode没有正常启动


 [hadoop@dtydb6 hadoop]$ jps
7427 Jps
7253 TaskTracker
6576 NameNode
6925 SecondaryNameNode
7079 JobTracker
 
 3,查看datanode的日志

Incompatible namespaceIDs
 java.io.IOException: Incompatible namespaceIDs in /hadoop/logdata: namenode namespaceID = 13513664; datanode namespaceID = 525507667

4,根据报错信息定位到namespaceIDs版本不一致

根据参考文档的解决方案,原因是多次格式化hadoop导致版本信息不一致,修改为一致状态即可解决问题
解决的办法很简单,两个方案

1). 所有的datanode删掉,重新建(很麻烦,但看你了)
2) 登上datanode,把位于{dfs.data.dir}/current/VERSION中的namespaceID改为最新的版本即可

[hadoop@dtydb6 current]$ cat VERSION
#Fri Dec 14 09:37:22 CST 2012
namespaceID=525507667
storageID=DS-120876865-10.4.124.236-50010-1354772633249
cTime=0
storageType=DATA_NODE
layoutVersion=-32


5,重新启动hadoop,datanode已经成功启动
[hadoop@dtydb6 current]$ jps
8770 JobTracker
8436 DataNode
8266 NameNode
8614 SecondaryNameNode
9107 Jps

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/72704fd16271dac82d58ecfe76aa0cb5.html