2016-01-17 11:43:53,019 INFO org.apache.hadoop.ipc.Server: IPC Server listener on 50020: starting 2016-01-17 11:43:54,455 INFO org.apache.hadoop.hdfs.server.common.Storage: Data-node version: -55 and name-node layout version: -57 2016-01-17 11:43:54,570 INFO org.apache.hadoop.hdfs.server.common.Storage: Lock on /opt/hadoop/data/hadoop-root/dfs/data/in_use.lock acquired by nodename 4816@localhost 2016-01-17 11:43:54,574 FATAL org.apache.hadoop.hdfs.server.datanode.DataNode: Initialization failed for Block pool <registering> (Datanode Uuid unassigned) service to localhost/127.0.0.1:9000. Exiting. java.io.IOException: Incompatible clusterIDs in /opt/hadoop/data/hadoop-root/dfs/data: namenode clusterID = CID-6f1b2a1b-2b93-4282-ac26-9aca48ec99ea; datanode clusterID = CID-5a313ef8-c96f-47bf-a7f9-3945ff5d9835 at org.apache.hadoop.hdfs.server.datanode.DataStorage.doTransition(DataStorage.java:477) at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:226) at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:254) at org.apache.hadoop.hdfs.server.datanode.DataNode.initStorage(DataNode.java:975) at org.apache.hadoop.hdfs.server.datanode.DataNode.initBlockPool(DataNode.java:946) at org.apache.hadoop.hdfs.server.datanode.BPOfferService.verifyAndSetNamespaceInfo(BPOfferService.java:278) at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.connectToNNAndHandshake(BPServiceActor.java:220) at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:812) at java.lang.Thread.run(Thread.java:662) 2016-01-17 11:43:54,576 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Ending block pool service for: Block pool <registering> (Datanode Uuid unassigned) service to localhost/127.0.0.1:9000 2016-01-17 11:43:54,733 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Removed Block pool <registering> (Datanode Uuid unassigned) 2016-01-17 11:43:56,734 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Exiting Datanode 2016-01-17 11:43:56,738 INFO org.apache.hadoop.util.ExitUtil: Exiting with status 0 2016-01-17 11:43:56,743 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: SHUTDOWN_MSG: |
從日誌上看,加粗的部分說明了問題 html
datanode的clusterID 和 namenode的clusterID 不匹配。 java
解決辦法: node
根據日誌中的路徑,/opt/hadoop/data/hadoop-root/dfs/ apache
能看到 data和name兩個文件夾, oop
由 hdfs-site.xml 默認配置文件能夠看出,data 和 name 文件目錄依賴 core-site.xml 的 hadoop.tmp.dir 參數 ui
dfs.namenode.name.dir | file://${hadoop.tmp.dir}/dfs/name |
dfs.datanode.data.dir | file://${hadoop.tmp.dir}/dfs/data |
<property>
<name>hadoop.tmp.dir</name>
<value>/opt/hadoop/data/hadoop-${user.name}</value>
</property>
|
將name/current下的VERSION中的clusterID複製到data/current下的VERSION中,覆蓋掉原來的clusterID spa
讓兩個保持一致 .net
而後重啓,啓動後執行jps,查看進程 日誌
[root@localhost hadoop]# jps
9518 SecondaryNameNode
9291 DataNode
9912 Jps
9138 NameNode
7626 ResourceManager
7797 NodeManager orm
出現該問題的緣由:在第一次格式化dfs後,啓動並使用了hadoop,後來又從新執行了格式化命令(hdfs namenode -format),這時namenode的clusterID會從新生成,而datanode的clusterID 保持不變。
參考文章
一、http://blog.csdn.net/zhangt85/article/details/42078347
二、http://www.cnblogs.com/kinglau/p/3796274.html