AM Max Resources限制Yarn App个数时怎么办
步骤一、capacity-scheduler.xml配置
<property>
<name>yarn.scheduler.capacity.maximum-am-resource-percent</name>
<value>0.1</value>
<description>
先修改这个配置,增大Am的使用资源的最大比率
</description>
</property>
步骤二、增加一个专门针对Queue级别的配置文件
<?xml version="1.0"?>
<allocations>
<queue name="root">
<minResources>2048 mb,1 vcores</minResources>
<maxResources>95% memory,95% cpu</maxResources>
<!--<maxChildResources>5% memory,5% cpu</maxChildResources>-->
<maxRunningApps>200</maxRunningApps>
<maxAMShare>1.0f</maxAMShare>
<weight>1</weight>
<schedulingPolicy>fair</schedulingPolicy>
<queue name="default">
<minResources>0% memory,0% cpu</minResources>
<maxResources>95% memory,95% cpu</maxResources>
<maxRunningApps>200</maxRunningApps>
<maxAMShare>1.0f</maxAMShare>
<weight>1</weight>
</queue> <!-- root子queue,这里可以根据实际并列几个子queue-->
</queue>
</allocations>
这个配置文件是针对Queue级别的。需要在Yarn-site.xml里面增加File的位置,才能生效。
yarn-site.xml增加如下配置(文件名称为fair-scheduler-allocation.xml)
<property>
<name>yarn.scheduler.fair.allocation.file</name>
<value>/app/app/hadoop/etc/hadoop/fair-scheduler-allocation.xml</value>
</property>