• 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。

  • 相关阅读:
    Qt应用开发(基础篇)——普通按钮类 QPushButton QCommandLinkButton
    【深度学习】3-从模型到学习的思路整理
    云计算的发展趋势和挑战
    面试字节跳动—真实面试题分享
    JAVA并发编程——CAS与AQS源码详解
    在Winform系统开发中,使用MediatR来实现类似事件总线的消息处理
    Semantic Kernel 学习笔记1
    【leaflet】学习笔记1-4
    数仓4.0(一)
    obsidian云同步方案记录
  • 原文地址:https://blog.csdn.net/u010022158/article/details/134061186