运行一个MapReduce任务,跟运行单节点时方法一样
java.io.IOException: Incompatible namespaceIDs
如果你看到错误java.io.IOException: Incompatible namespaceIDs in the logs of a datanode (<HADOOP_INSTALL>/logs/hadoop-hadoop-datanode-
<HOSTNAME>.log), 很可能是因为你遇到了 HADOOP-1212 这个bug(反正我是遇到了).
... ERROR org.apache.hadoop.dfs.DataNode: java.io.
IOException: Incompatible namespaceIDs in /usr/local/hadoop-datastore/hadoop-
hadoop/dfs/data: namenode namespaceID = 308967713; datanode namespaceID = 113030094
at org.apache.hadoop.dfs.DataStorage.doTransition(DataStorage.java:281)
at org.apache.hadoop.dfs.DataStorage.recoverTransitionRead(DataStorage.java:121)
at org.apache.hadoop.dfs.DataNode.startDataNode(DataNode.java:230)
at org.apache.hadoop.dfs.DataNode.<init>(DataNode.java:199)
at org.apache.hadoop.dfs.DataNode.makeInstance(DataNode.java:1202)
at org.apache.hadoop.dfs.DataNode.run(DataNode.java:1146)
at org.apache.hadoop.dfs.DataNode.createDataNode(DataNode.java:1167)
at org.apache.hadoop.dfs.DataNode.main(DataNode.java:1326)
解决方案
1. 停止集群
2. 删除conf/hadoop-site.xml中dfs.data.dir指定目录中的data目录,比如/your/path/to/hadoop/tmp/dir/hadoop-hadoop/dfs/data
3. 重新格式化集群文件系统
--转自