• Hadoop 请求数据长度 Requested Data length 超过配置的最大值


    一、问题

    现象

    Spark 任务速度变慢,也不失败。

    DataNode 内存足够 CPU 负载不高 GC 时间也不长。

    查看 DataNode 日志,发现有些日志出现很多 Netty RPC 超时。超时的 destination 是一个 NameNode 节点,然后查看 NameNode 节点的日志,报错如下:

    在这里插入图片描述

    二、解决方案

    查找对应 Hadopo 源码

    源码
    org.apache.hadoop.ipc.Server.Connection#checkDataLength

        private void checkDataLength(int dataLength) throws IOException {
          if (dataLength < 0) {
            String error = "Unexpected data length " + dataLength +
                           "!! from " + getHostAddress();
            LOG.warn(error);
            throw new IOException(error);
          } else if (dataLength > maxDataLength) { 
            String error = "Requested data length " + dataLength +
                  " is longer than maximum configured RPC length " + 
                maxDataLength + ".  RPC came from " + getHostAddress();
            LOG.warn(error);
            throw new IOException(error);    // <-------------- 异常从此处抛出来
          }
        }
    
    this.maxDataLength = conf.getInt(CommonConfigurationKeys.IPC_MAXIMUM_DATA_LENGTH,
           CommonConfigurationKeys.IPC_MAXIMUM_DATA_LENGTH_DEFAULT);
    
      /** Max request size a server will accept. */
      public static final String IPC_MAXIMUM_DATA_LENGTH =
          "ipc.maximum.data.length";
      /** Default value for IPC_MAXIMUM_DATA_LENGTH. */
      public static final int IPC_MAXIMUM_DATA_LENGTH_DEFAULT = 64 * 1024 * 1024;
    
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25

    修改NameNode的hdfs-site.xml配置文件,添加以下配置:

    <property>
      <name>ipc.maximum.data.lengthname>
      <value>67108864value>
      <description>This indicates the maximum IPC message length (bytes) that can be
        accepted by the server. Messages larger than this value are rejected by the
        immediately to avoid possible OOMs. This setting should rarely need to be
        changed.
      description>
    property>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    64M -> 256M

    67108864 * 4 = 268435456

    允许ipc通讯最大的数据包为256MB,默认配置为64MB。

    最后重启 NameNode,再重启 DataNode。

  • 相关阅读:
    Centos7.9中使用Docker安装云崽机器人
    数据结构 桶排序 基数排序
    TwineCompile高级编译系统
    eyb:项目介绍到获取用户信息功能实现(一)
    Day12--渲染二级和三级分类列表
    一个产品级MCU菜单框架设计
    嵌入式学习笔记(36)什么是定时器
    大学四年,我建议你这么学网络安全
    【让你从0到1学会C语言】指针/数组传参以及static关键字
    一些没什么技巧的数据结构
  • 原文地址:https://blog.csdn.net/u010022158/article/details/134061186