• 从节点JPS没有dataNode的解决办法


    从节点JPS没有dataNode的解决办法

    查看logs日志文件,找到Hadoop的安装目录下logs目录,用cat hadoop-root-datanode-localhost.localdomain.log进行日志查看

    1、java.net.BindException: 无法指定被请求的地址

    另一种错误表现方式是:执行hadoop fs -put命令报错could only be replicated to 0 nodes instead of minReplication (=1)
    报错大致如下:

    20/12/01 00:45:48 WARN hdfs.DFSClient: DataStreamer Exception
    org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /Hadoop/Input/wordcount.txt._COPYING_ could only be replicated to 0 nodes instead of minReplication (=1).  There are 0 datanode(s) running and no node(s) are excluded in this operation.
    	at org.apache.hadoop.hdfs.server.blockmanagement.BlockManager.chooseTarget4NewBlock(BlockManager.java:1571)
    	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getNewBlockTargets(FSNamesystem.java:3107)
    	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:3031)
    	at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:725)
    	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:492)
    	at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
    	at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:616)
    	at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:982)
    	at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2049)
    	at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2045)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at javax.security.auth.Subject.doAs(Subject.java:422)
    	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1698)
    	at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2043)
    
    	at org.apache.hadoop.ipc.Client.call(Client.java:1475)
    	at org.apache.hadoop.ipc.Client.call(Client.java:1412)
    	at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:229)
    	at com.sun.proxy.$Proxy10.addBlock(Unknown Source)
    	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.addBlock(ClientNamenodeProtocolTranslatorPB.java:418)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:191)
    	at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)
    	at com.sun.proxy.$Proxy11.addBlock(Unknown Source)
    	at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.locateFollowingBlock(DFSOutputStream.java:1455)
    	at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.nextBlockOutputStream(DFSOutputStream.java:1251)
    	at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:448)
    put: File /Hadoop/Input/wordcount.txt._COPYING_ could only be replicated to 0 nodes instead of minReplication (=1).  There are 0 datanode(s) running and no node(s) are excluded in this operation.
    

    解决办法

    在主节点执行JPS命令显示

    [root@master logs]# jps
    7282 NameNode
    7764 ResourceManager
    8153 Jps
    7551 SecondaryNameNode
    
    

    从节点执行JPS命令显示

    [root@localhost current]# jps
    4600 Jps
    4426 NodeManager
    

    显示错误原因是因为dataNode没有启动成功。
    下面我们查找dataNode启动失败的原因:
    在从节点上找到Hadoop的安装目录下logs
    目录,打开cat hadoop-root-datanode-localhost.localdomain.log
    查找错误,我的错误日志如下:

    2020-12-02 18:18:46,740 INFO org.apache.hadoop.http.HttpServer2: HttpServer.start() threw a non Bind IOException
    java.net.BindException: Port in use: localhost:0
    	at org.apache.hadoop.http.HttpServer2.openListeners(HttpServer2.java:919)
    	at org.apache.hadoop.http.HttpServer2.start(HttpServer2.java:856)
    	at org.apache.hadoop.hdfs.server.datanode.web.DatanodeHttpServer.<init>(DatanodeHttpServer.java:104)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.startInfoServer(DataNode.java:760)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:1112)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:429)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:2374)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:2261)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:2308)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.java:2485)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:2509)
    Caused by: java.net.BindException: 无法指定被请求的地址
    	at sun.nio.ch.Net.bind0(Native Method)
    	at sun.nio.ch.Net.bind(Net.java:433)
    	at sun.nio.ch.Net.bind(Net.java:425)
    	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
    	at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    	at org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216)
    	at org.apache.hadoop.http.HttpServer2.openListeners(HttpServer2.java:914)
    	... 10 more
    2020-12-02 18:18:46,745 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Shutdown complete.
    2020-12-02 18:18:46,745 FATAL org.apache.hadoop.hdfs.server.datanode.DataNode: Exception in secureMain
    java.net.BindException: Port in use: localhost:0
    	at org.apache.hadoop.http.HttpServer2.openListeners(HttpServer2.java:919)
    	at org.apache.hadoop.http.HttpServer2.start(HttpServer2.java:856)
    	at org.apache.hadoop.hdfs.server.datanode.web.DatanodeHttpServer.<init>(DatanodeHttpServer.java:104)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.startInfoServer(DataNode.java:760)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:1112)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:429)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:2374)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:2261)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:2308)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.java:2485)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:2509)
    Caused by: java.net.BindException: 无法指定被请求的地址
    	at sun.nio.ch.Net.bind0(Native Method)
    	at sun.nio.ch.Net.bind(Net.java:433)
    	at sun.nio.ch.Net.bind(Net.java:425)
    	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
    	at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    	at org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216)
    	at org.apache.hadoop.http.HttpServer2.openListeners(HttpServer2.java:914)
    	... 10 more
    2020-12-02 18:18:46,746 INFO org.apache.hadoop.util.ExitUtil: Exiting with status 1
    2020-12-02 18:18:46,748 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: SHUTDOWN_MSG: 
    /************************************************************
    SHUTDOWN_MSG: Shutting down DataNode at master/192.168.242.139
    ************************************************************/
    
    

    可以清楚的看到是因为HOSTS文件配置不对引起的故障,把HOSTS文件
    增加配置如下(我的HOSTS没有如下配置是因为被删除掉了……):

    127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
    

    重新在主节点上启动“start-all.sh”,然后在从节点上执行JPS查看

    [root@localhost logs]# jps
    5398 Jps
    5131 NodeManager
    4958 DataNode
    
    

    可以看到dataNode已经成功起动。

    2、clusterID两个ID不相等

    在各从节点点查看:
    cat hadoop-root-datanode-localhost.localdomain.log大致错误如下:

    2020-12-09 18:10:40,810 WARN org.apache.hadoop.hdfs.server.common.Storage: Failed to add storage directory [DISK]file:/opt/hadoop-2.7.3/tmp/
    java.io.IOException: Incompatible clusterIDs in /opt/hadoop-2.7.3/tmp: namenode clusterID = CID-f9f0e847-beee-4d43-9e59-24687906ef30; datanode clusterID = CID-58e9d874-8916-44b8-841c-723e950b1f41
    	at org.apache.hadoop.hdfs.server.datanode.DataStorage.doTransition(DataStorage.java:775)
    	at org.apache.hadoop.hdfs.server.datanode.DataStorage.loadStorageDirectory(DataStorage.java:300)
    	at org.apache.hadoop.hdfs.server.datanode.DataStorage.loadDataStorage(DataStorage.java:416)
    	at org.apache.hadoop.hdfs.server.datanode.DataStorage.addStorageLocations(DataStorage.java:395)
    	at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:573)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.initStorage(DataNode.java:1362)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.initBlockPool(DataNode.java:1327)
    	at org.apache.hadoop.hdfs.server.datanode.BPOfferService.verifyAndSetNamespaceInfo(BPOfferService.java:317)
    	at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.connectToNNAndHandshake(BPServiceActor.java:223)
    	at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:802)
    	at java.lang.Thread.run(Thread.java:745)
    2020-12-09 18:10:40,814 FATAL org.apache.hadoop.hdfs.server.datanode.DataNode: Initialization failed for Block pool <registering> (Datanode Uuid unassigned) service to master/192.168.242.139:8020. Exiting. 
    java.io.IOException: All specified directories are failed to load.
    	at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:574)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.initStorage(DataNode.java:1362)
    	at org.apache.hadoop.hdfs.server.datanode.DataNode.initBlockPool(DataNode.java:1327)
    	at org.apache.hadoop.hdfs.server.datanode.BPOfferService.verifyAndSetNamespaceInfo(BPOfferService.java:317)
    	at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.connectToNNAndHandshake(BPServiceActor.java:223)
    	at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:802)
    	at java.lang.Thread.run(Thread.java:745)
    2020-12-09 18:10:40,815 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Ending block pool service for: Block pool <registering> (Datanode Uuid unassigned) service to master/192.168.242.139:8020
    
    

    解决办法

    查看core-site.xml,找到存namenode元数据和datanode元数据的路径。

    <name>hadoop.tmp.dir</name>
    <value>/opt/hadoop-2.7.3/tmp</value>
    

    在这个路径/opt/hadoop-2.7.3/tmp下去找datanodeVERSION文件,把从节点的clusterID 改成与主节点的相同,然后再主节点上执行start-dfs.sh试试,如果这时在从节点上执行jps命令后,发现DataNode已经启动了,证明此方法可行。

    3、报clusterID不一样,但是VERSION文件的clusterID确与主节点一样的解决方法

    有时候会碰到日志文件同样报clusterID不一样,但是经过确认VERSION文件的clusterID确实同主节点一样。这个时候查看下core-site.xml配置的datanode路径下是不是多了一个current文件,这个时候current文件夹下两样也有一个一样的VERSION文件,直接执行 rm -rf current/ 把该文件夹及文件夹下所有内容删除,再主节点上执行start-dfs.sh试试。

  • 相关阅读:
    面向对象
    面向对象
    面向对象
    面向对象
    面向对象
    面向对象
    面向对象
    面向对象
    3.1
    面向对象
  • 原文地址:https://www.cnblogs.com/zh672903/p/14113529.html
Copyright © 2020-2023  润新知