Jan 9

启动hadoop 2.6.0遇到的datanode启动不了Initialization failed for Block pool 不指定

admin , 22:53 , Hadoop , 评论(0) , 引用(0) , 阅读(1726) , Via 本站原创 | |
搜索
我已经获得阿里云幸运券,准备分享给您。请点击获取  

启动hadoop 2.6.0遇到的datanode启动不了
查看日志报DataNode: Initialization failed for Block pool <registering> (Datanode Uuid unassigned) 的原因:
日志如下:
2017-01-09 21:44:29,890 INFO org.apache.hadoop.ipc.Server: Starting Socket Reader #1 for port 50020
2017-01-09 21:44:37,748 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Opened IPC server at /0.0.0.0:50020
2017-01-09 21:44:41,234 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Refresh request received for nameservices: null
2017-01-09 21:44:48,807 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Starting BPOfferServices for nameservices: <default>
2017-01-09 21:44:52,476 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Block pool <registering> (Datanode Uuid unassigned) service to localhost/127.0.0.1:9000 starting to offer service
2017-01-09 21:44:55,043 INFO org.apache.hadoop.ipc.Server: IPC Server Responder: starting
2017-01-09 21:44:55,042 INFO org.apache.hadoop.ipc.Server: IPC Server listener on 50020: starting
2017-01-09 21:45:48,810 INFO org.apache.hadoop.hdfs.server.common.Storage: DataNode version: -56 and NameNode layout version: -60
2017-01-09 21:45:49,795 INFO org.apache.hadoop.hdfs.server.common.Storage: Lock on /usr/local/hadoop/tmp/dfs/data/in_use.lock acquired by nodename 12516@itlife365
2017-01-09 21:45:50,452 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 /usr/local/hadoop/tmp/dfs/data: namenode clusterID = CID-ac5a910b-e86a-4659-877e-273373a5dd3d; datanode clusterID = CID-d09e5c30-943e-471e-a621-6ce7f5ebb227
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.doTransition(DataStorage.java:646)
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.addStorageLocations(DataStorage.java:320)
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:403)
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:422)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.initStorage(DataNode.java:1311)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.initBlockPool(DataNode.java:1276)


从日志上看,加粗的部分说明了问题
datanode的clusterID 和 namenode的clusterID 不匹配。

百度后发现原因
出现该问题的原因:在第一次格式化dfs后,启动并使用了hadoop,后来又重新执行了格式化命令(hdfs namenode -format),这时namenode的clusterID会重新生成,而datanode的clusterID 保持不变。

原因:每次namenode format会重新创建一个namenodeId,而data目录包含了上次format时的id,namenode format清空了namenode下的数据,但是没有清空datanode下的数据,导致启动时失败,所要做的就是每次fotmat前,清空data下的所有目录.
解决办法:停掉集群,删除问题节点的data目录下的所有内容。即hdfs-site.xml文件中配置的dfs.data.dir目录。重新格式化namenode
另一个更省事的办法:先停掉集群,然后将datanode节点目录/dfs/data/current/VERSION中的修改为与namenode一致即可。

解决办法:
根据日志中的路径,cd /home/hadoop/tmp/dfs
能看到 data和name两个文件夹,

将name/current下的VERSION中的clusterID复制到data/current下的VERSION中,即把data/current的VERSION中的clusterID 改为和name/current的VERSION中的clusterID一致
然后重启,启动后执行jps,查看进程
-----比对如下:

[hadoop@itlife365 dfs]$ cat name/current/VERSION
#Mon Jan 09 21:21:32 HKT 2017
namespaceID=683331641
clusterID=CID-ac5a910b-e86a-4659-877e-273373a5dd3d
cTime=0
storageType=NAME_NODE
blockpoolID=BP-1078861270-192.168.56.10-1483968091711
layoutVersion=-60
[hadoop@itlife365 dfs]$ cat date/current/VERSION
cat: date/current/VERSION: No such file or directory
[hadoop@itlife365 dfs]$ cat data/current/VERSION
#Mon Jan 09 20:28:32 HKT 2017
storageID=DS-b28ee3d9-4aed-4b79-bb62-21394c9e0357
clusterID=CID-d09e5c30-943e-471e-a621-6ce7f5ebb227
cTime=0
datanodeUuid=74bd774b-086b-480c-bbfe-3d45f3149c07
storageType=DATA_NODE
layoutVersion=-56
[hadoop@itlife365 dfs]$ pwd
/usr/local/hadoop/tmp/dfs
[hadoop@itlife365 dfs]$
data/current/VERSION
修改后重启解决如下
[hadoop@itlife365 hadoop]$ ./sbin/stop-dfs.sh
17/01/09 22:18:07 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Stopping namenodes on [localhost]
localhost: stopping namenode
localhost: no datanode to stop
Stopping secondary namenodes [0.0.0.0]
0.0.0.0: stopping secondarynamenode
17/01/09 22:19:20 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@itlife365 hadoop]$ ./sbin/start-dfs.sh
17/01/09 22:19:49 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [localhost]
localhost: starting namenode, logging to /usr/local/hadoop/logs/hadoop-hadoop-namenode-itlife365.out
localhost: starting datanode, logging to /usr/local/hadoop/logs/hadoop-hadoop-datanode-itlife365.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /usr/local/hadoop/logs/hadoop-hadoop-secondarynamenode-itlife365.out
17/01/09 22:27:08 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@itlife365 hadoop]$ jps
13433 DataNode
13735 Jps
13552 SecondaryNameNode
13350 NameNode
[hadoop@itlife365 hadoop]$
hadoop-Datanode-Uuid-unassigned-solved
-----end

Tags: