美文网首页
copyFromLocal: File /test/file/t

copyFromLocal: File /test/file/t

作者: 程序媛啊 | 来源:发表于2018-04-27 23:01 被阅读0次

    1、搭建好hadoop后使用hadoop fs -put 命令上传文件发现失败,报了以下错误:

    14/08/18 15:18:03 WARN hdfs.DFSClient: DataStreamer Exception
    org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /home/input/file1.txt._COPYING_ could only be replicated to 0 nodes instead of minReplication (=1).  There are 2 datanode(s) running and no node(s) are excluded in this operation.
            at org.apache.hadoop.hdfs.server.blockmanagement.BlockManager.chooseTarget(BlockManager.java:1384)
            at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:2477)
            at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:555)
            at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:387)
            at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java:59582)
            at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585)
            at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:928)
            at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2048)
            at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2044)
            at java.security.AccessController.doPrivileged(Native Method)
            at javax.security.auth.Subject.doAs(Subject.java:396)
            at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491)
            at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2042)
            at org.apache.hadoop.ipc.Client.call(Client.java:1347)
            at org.apache.hadoop.ipc.Client.call(Client.java:1300)
            at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:206)
            at $Proxy9.addBlock(Unknown Source)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:186)
            at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)
            at $Proxy9.addBlock(Unknown Source)
            at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.addBlock(ClientNamenodeProtocolTranslatorPB.java:330)
            at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.locateFollowingBlock(DFSOutputStream.java:1226)
            at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.nextBlockOutputStream(DFSOutputStream.java:1078)
    

    看它的报错信息好像是节点没有启动,但是我的节点都启动起来了,使用jps也能查看到节点信息。
    使用hadoop dfsadmin -report命令查看磁盘使用情况,发现出现以下问题:

    Configured Capacity: 0 (0 B)
    Present Capacity: 0 (0 B)
    DFS Remaining: 0 (0 B)
    DFS Used: 0 (0 B)
    DFS Used%: NaN%
    Under replicated blocks: 0
    Blocks with corrupt replicas: 0
    Missing blocks: 0
    -------------------------------------------------
    Datanodes available: 0 (0 total, 0 dead)
    

    节点下存储空间都是空的,问题应该就是出现在这了。
    查阅资料发现造成这个问题的原因可能是使用hadoop namenode -format格式化时格式化了多次造成那么spaceID不一致,解决方案:

    1、停止集群(切换到/sbin目录下)
    $./stop-all.sh

    2、删除在hdfs中配置的data目录(即在core-site.xml中配置的hadoop.tmp.dir对应文件件)下面的所有数据;
    $ rm -rf /home/hadoop/hdpdata/*

    3、重新格式化namenode(切换到hadoop目录下的bin目录下)
    $ ./hadoop namenode -format

    4、重新启动hadoop集群(切换到hadoop目录下的sbin目录下)
    $./start-all.sh

    在使用hadoop dfsadmin -report查看使用情况,结果如下图所示:


    image.png

    转载于:
    https://blog.csdn.net/fragrant_no1/article/details/85710041

    二、或者做如下操作
    1、关闭datanode防火墙
    2、或者打开端口
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 9000 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 50020 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 20060 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 50075 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 50090 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 50030 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 50070 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 50010 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 8020 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 8021 -j ACCEPT

    转载于:https://www.cnblogs.com/tudoua/p/6963803.html

    相关文章

      网友评论

          本文标题:copyFromLocal: File /test/file/t

          本文链接:https://www.haomeiwen.com/subject/qfcwlftx.html