查看日誌以下: java
2014-06-18 20:34:59,622 FATAL org.apache.hadoop.hdfs.server.datanode.DataNode: Initialization failed for block pool Block pool <registering> (Datanode Uuid unassigned) service to localhost/127.0.0.1:9000
java.io.IOException: Incompatible clusterIDs in /usr/local/hadoop/hdfs/data: namenode clusterID = CID-af6f15aa-efdd-479b-bf55-77270058e4f7; datanode clusterID = CID-736d1968-8fd1-4bc4-afef-5c72354c39ce
at org.apache.hadoop.hdfs.server.datanode.DataStorage.doTransition(DataStorage.java:472)
at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:225)
at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:249)
at org.apache.hadoop.hdfs.server.datanode.DataNode.initStorage(DataNode.java:929)
at org.apache.hadoop.hdfs.server.datanode.DataNode.initBlockPool(DataNode.java:900)
at org.apache.hadoop.hdfs.server.datanode.BPOfferService.verifyAndSetNamespaceInfo(BPOfferService.java:274)
at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.connectToNNAndHandshake(BPServiceActor.java:220)
at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:815)
at java.lang.Thread.run(Thread.java:744)node
從日誌中能夠看出,緣由是由於datanode的clusterID 和 namenode的clusterID 不匹配。apache
打開hdfs-site.xml裏配置的datanode和namenode對應的目錄,分別打開current文件夾裏的VERSION,能夠看到clusterID項正如日誌裏記錄的同樣,確實不一致,修改datanode裏VERSION文件的clusterID 與namenode裏的一致,再從新啓動dfs(執行start-dfs.sh)再執行jps命令能夠看到datanode已正常啓動。oop
出現該問題的緣由:在第一次格式化dfs後,啓動並使用了hadoop,後來又從新執行了格式化命令(hdfs namenode -format),這時namenode的clusterID會從新生成,而datanode的clusterID 保持不變。ui