Hadoop 中的datanode无法启动

问题描述:

2018-08-16 11:33:56,570 WARN org.apache.hadoop.hdfs.server.common.Storage: Failed to add storage directory [DISK]file:/opt/hdfs/data/
java.io.IOException: Incompatible clusterIDs in /opt/hdfs/data: namenode clusterID = CID-4a768407-d698-4490-9662-fadd282d8631; datanode clusterID = CID-3667822c-ea1a-4c25-a685-5ff336eb4317
    at org.apache.hadoop.hdfs.server.datanode.DataStorage.doTransition(DataStorage.java:760)
    at org.apache.hadoop.hdfs.server.datanode.DataStorage.loadStorageDirectory(DataStorage.java:293)
    at org.apache.hadoop.hdfs.server.datanode.DataStorage.loadDataStorage(DataStorage.java:409)
    at org.apache.hadoop.hdfs.server.datanode.DataStorage.addStorageLocations(DataStorage.java:388)
    at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:556)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.initStorage(DataNode.java:1574)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.initBlockPool(DataNode.java:1535)
    at org.apache.hadoop.hdfs.server.datanode.BPOfferService.verifyAndSetNamespaceInfo(BPOfferService.java:382)
    at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.connectToNNAndHandshake(BPServiceActor.java:266)
    at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:750)
    at java.lang.Thread.run(Thread.java:748)
2018-08-16 11:33:56,573 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Block pool ID needed, but service not yet registered with NN, trace:
java.lang.Exception
    at org.apache.hadoop.hdfs.server.datanode.BPOfferService.getBlockPoolId(BPOfferService.java:210)
    at org.apache.hadoop.hdfs.server.datanode.BPOfferService.hasBlockPoolId(BPOfferService.java:220)
    at org.apache.hadoop.hdfs.server.datanode.BPOfferService.shouldRetryInit(BPOfferService.java:826)
    at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.shouldRetryInit(BPServiceActor.java:792)
    at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:755)
    at java.lang.Thread.run(Thread.java:748)
2018-08-16 11:33:56,573 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: Initialization failed for Block pool  (Datanode Uuid 87dc086d-c141-4de7-a943-c8c97d635dac) service to masternode/172.16.78.67:8000. Exiting. 
java.io.IOException: All specified directories are failed to load.
    at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:557)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.initStorage(DataNode.java:1574)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.initBlockPool(DataNode.java:1535)
    at org.apache.hadoop.hdfs.server.datanode.BPOfferService.verifyAndSetNamespaceInfo(BPOfferService.java:382)
    at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.connectToNNAndHandshake(BPServiceActor.java:266)
    at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:750)
    at java.lang.Thread.run(Thread.java:748)

解决步骤:
1.namenode

more /opt/hdfs/name/current/VERSION 
复制:clusterID=CID-4a768407-d698-4490-9662-fadd282d8631

2.datanode

vi /opt/hdfs/data/current/VERSION
粘贴:clusterID=CID-4a768407-d698-4490-9662-fadd282d8631

然后重启即可。
jps显示正常

你可能感兴趣的:(Hadoop学习篇)