为了账号安全,请及时绑定邮箱和手机立即绑定

hadoop错误could only be replicated to > 0 nodes,

hadoop错误could only be replicated to > 0 nodes,

qq_花开花谢_0 2018-10-11 21:17:11
求指教hadoop的这个错误 org.apache.hadoop.ipc.RemoteException: java.io.IOException: File > /user/hadoop/testfiles/testfiles/file1.txt could only be replicated to > 0 nodes, instead of 1 困扰我好久了 任何办法 包括权限检查、顺序启动、hdfs格式化等都试过了 一直不行 反复配置还是不行 不知道大家有没碰到过
查看完整描述

1 回答

?
largeQ

TA贡献2039条经验 获得超7个赞

从代码看,可能是楼主没有启动datanode,或者所有datanode都和namenode断连了。楼主可以去namenode的web页面看看。

chooseTarget方法是说从datanode中选择n个存储楼主的文件。

 /**
   * Choose target datanodes according to the replication policy.
   * 
   * @throws IOException
   *           if the number of targets < minimum replication.
   * @see BlockPlacementPolicy#chooseTarget(String, int, DatanodeDescriptor,
   *      List, boolean, HashMap, long)
   */
  public DatanodeDescriptor[] chooseTarget(final String src,    
    final int numOfReplicas, final DatanodeDescriptor client,      
    final HashMap<Node, Node> excludedNodes,      
    final long blocksize) throws IOException {  
      // choose targets for the new block to be allocated.
    final DatanodeDescriptor targets[] = blockplacement.chooseTarget(src,
        numOfReplicas, client, new ArrayList<DatanodeDescriptor>(), false,
        excludedNodes, blocksize);    if (targets.length < minReplication) {  
            throw new IOException("File " + src + " could only be replicated to "
          + targets.length + " nodes instead of minReplication (="
          + minReplication + ").  There are "
          + getDatanodeManager().getNetworkTopology().getNumOfLeaves()
          + " datanode(s) running and "
          + (excludedNodes == null? "no": excludedNodes.size())
          + " node(s) are excluded in this operation.");
    }    return targets;
  }


查看完整回答
反对 回复 2018-10-27
  • 1 回答
  • 0 关注
  • 948 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信