在自己的虚拟机上重新编译Hadoop-0.20.2-cdh3u3后启动hadoop, 发现datanode没有起来.[hadoop@localhost bin]$ hadoop dfsadmin -report Configured Capacity: 0 (0 KB) Present Capacity: 0 (0 KB) DFS Remaining: 0 (0 KB) DFS Used: 0 (0 KB) DFS Used%: 锟? Under replicated blocks: 0 Blocks with corrupt replicas: 0 Missing blocks: 0 ------------------------------------------------- Datanodes available: 0 (0 total, 0 dead)
转到日志目录, 查看datanode日志,发现如下异常:
2012-03-27 18:20:12,275 INFO org.apache.hadoop.security.UserGroupInformation: JAAS Configuration already set up for Hadoop, not re-installing. 2012-03-27 18:20:12,334 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Incompatible namespaceIDs in /opt/hdfs1: namenode namespaceID = 2020402075; datanode namespaceID = 728558412 at org.apache.hadoop.hdfs.server.datanode.DataStorage.doTransition(DataStorage.java:238) at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:153) at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:410) at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:305) at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:1606) at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:1546) at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:1564) at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.java:1690) at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:1707) 2012-03-27 18:20:12,334 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: SHUTDOWN_MSG: /************************************************************ SHUTDOWN_MSG: Shutting down DataNode at localhost.localdomain/127.0.0.1 ************************************************************/datanode下的 namespaceID 与namenode的 namespaceID 不一致导致
看下namenode下 VERSION
对比datanode下VERSION
[hadoop@localhost current]$ pwd /opt/hdfs1/current [hadoop@localhost current]$ cat VERSION #Tue Mar 27 18:16:39 PDT 2012 namespaceID=728558412 storageID=DS-1857008061-127.0.0.1-50010-1330145936216 cTime=0 storageType=DATA_NODE layoutVersion=-19编辑datanode下的VERSION,使 namespaceID 值与namenode下的值相同, 重新启动datanode
验证:
可以看到,datanode已经起来!