hadoop fs -put上傳文件失敗,WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Problem connecting to server: master:8020


hadoop fs -put上傳文件失敗

報錯信息:(test文件夾是已經成功建好的)

[root@master ~]# hadoop fs -put test1.txt /test
18/12/27 03:50:53 WARN hdfs.DFSClient: DataStreamer Exception
org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /test/test1.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:1620)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getNewBlockTargets(FSNamesystem.java:3135)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:3059)
        at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:725)
        at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:493)
        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:2217)
        at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2213)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:415)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1762)
        at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2211)

        at org.apache.hadoop.ipc.Client.call(Client.java:1476)
        at org.apache.hadoop.ipc.Client.call(Client.java:1413)
        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:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        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:1603)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.nextBlockOutputStream(DFSOutputStream.java:1388)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:554)
put: File /test/test1.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.

Linux報的錯誤是datanode節點不存在,但是去slave機器上jps發現datanode運行的好好的。然后去網上查找資料,有博客說是因為沒關閉防火牆,沒有訪問權限, 好嘛,又去關防火牆,結果命令又不存在,因為實驗室分配的機器太老了(好像是Red Hat4.x Linux3.x版本的),又吭哧吭哧裝了半天命令,再查看防火牆,是關閉的啊,我真的是頭疼。

 

然后接着找其他解決方案吧,參考資料2說可能是format次數太多,導致每次的spaceId不一致,現在想來,我確實是format了很多次,那就先來試試。

首先停止所有服務 stop-all.sh。

然后刪除 core-site.xml 中hadoop.tmp.dir對應的文件夾下所有數據,注意:不是把這個文件夾也刪掉! sudo rm -rf /root/software/hadooptmp 

在之后重新格式化namenode,在bin目錄下 hdfs namenode -format 

重新啟動hadoop集群,start-all.sh

再來試試,還是不行。。

最后還是老老實實看datanode的logs,發現是無法連接上master的8020端口。

在同學的提醒下,我發現之前的hostname與ip的映射只在mater上做了,slave機器沒有做,這也就造成了datanode無法連接到master,太太蠢了簡直。

這也是給自己提個醒,不能太依賴網上的資料,普遍真理結合具體實際才可以順利解決問題=_=

 

參考資料:

1、Failed to execute operation: No such file or directory(systemctl enable iptables.service)

2、File /input/data.txt._COPYING_ could only be replicated to 0 nodes instead of minReplication (=1)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM