【调优/排错】Hadoop:flink on yarn 模式下提示yarn资源不足:Running and Pending Application Limits

发布时间:2026/11/3 9:09:52
【调优/排错】Hadoop:flink on yarn 模式下提示yarn资源不足:Running and Pending Application Limits

文章目录

      • 1. 问题现象
      • 2. 问题说明
      • 3. 修改适配

1. 问题现象

相关log:

INFO org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue: not starting application as amIfStarted exceeds amLimit INFO org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue: Application added - appId: application_1593338489799_0317 user: org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue$User@6c0d5b4d, leaf-queue: default#user-pending-applications: 1 #user-active-applications: 15 #queue-pending-applications: 1 #queue-active-applications: 15
That your drivers have exceeded max memory configuredinMax Application Master Resources. You can either increase max memoryforAM or decrease driver memoryinyour jobs.

2. 问题说明

资源不足时,yarn会有两种选择:

  1. flink作业并没有pending等待资源的分配,而是直接打印一行fail的log,直接就fail掉了。
  2. flink作业pending等待资源的分配,一直等待之前的flink作业执行完,等待有资源分配给自己来执行。

问题说明:

这种一般出现在多个任务同时运行,导致AM占用的内存比例超过了设置的maximum-am-resource-percent,当再提交任务时,因为AM申请不到足够的资源,导致任务pending,最后资源虽然充足但是提交不了任务。

此时可以适当的提高AM内存比例。

3. 修改适配

配置文件:capacity-scheduler.xml

<property><name>yarn.scheduler.capacity.maximum-am-resource-percent</name><value>0.5</value><description>Maximum percent of resources in the cluster which can be used to run application masters i.e. controls number of concurrent running applications. 1. 运行appmaster的最大资源,为了控制集群中并发运行的app。对于flink来说 appmaster对应的是jobmanager。 2. 建议修改配置大于默认的0.1。</description></property>

执行命令:刷新配置。

yarn rmadmin-refreshQueues