hadoop Incompatible namespaceIDs

错误:

ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Incompatible namespaceIDs

DataNode的VERSION内容:

[hadoop@dl180-2 current]$ more /hdfs/tmp/dfs/data/current/VERSION

#Mon Feb 25 07:42:26 HKT 2002

namespaceID=698320168

storageID=DS-222936147-10.200.6.22-50010-1014593256887

cTime=0

storageType=DATA_NODE

layoutVersion=-18

NameNode的VERSION内容有两个:

[hadoop@dl180-1 logs]$ more /hdfs/tmp/dfs/data/current/VERSION

#Thu Jun 16 06:36:44 HKT 2011

namespaceID=614577025

storageID=DS-469431412-10.200.6.21-50010-1307497858931

cTime=0

storageType=DATA_NODE

layoutVersion=-18
[hadoop@dl180-1 history]$ more /hdfs/tmp/dfs/name/current/VERSION

#Thu Jun 16 06:46:16 HKT 2011

namespaceID=614577025

cTime=0

storageType=NAME_NODE

layoutVersion=-18

解决方法:

把DataNode上的namespaceID改成跟NameNode的一致即可。

用脚本可以循环一次执行完:

for i in `cat ~/hadoop/conf/slaves`;do ssh $i sed -i 's/698320168/614577025/' /hdfs/tmp/dfs/data/current/VERSION; echo $i; echo ; done

相关推荐