hadoop yarn调度规则
Last updated on July 20, 2025 pm
🧙 Questions
☄️ Ideas
Fair Scheduler
公平调度
配置yarn-site.xml
vim /opt/hadoop/etc/hadoop/yarn-site.xml
<!-- 开启公平调度 -->
<property>
<name>yarn.resourcemanager.scheduler.class</name>
<value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler</value>
</property>
<!-- 可以配置调度器 -->
<property>
<name>yarn.scheduler.fair.allocation.file</name>
<value>/opt/hadoop/etc/hadoop/fair-scheduler.xml</value>
</property>
vim /opt/hadoop/etc/hadoop/fair-scheduler.xml
默认用户提交,跟着用户的队列走
<?xml version="1.0"?>
<allocations>
<!-- 队列名 -->
<queue name="default">
<!-- 最小启动资源 -->
<minResources>2048 mb,1vcores</minResources>
<!-- 最大启动资源 -->
<maxResources>5120 mb,2vcores</maxResources>
<maxRunningApps>1</maxRunningApps>
<!-- 最大可使用资源,百分之 -->
<maxAMShare>1</maxAMShare>
<weight>2.0</weight>
</queue>
</allocations>
<!-- 正在使用的资源 -->
Used Resources: <memory:0, vCores:0>
<!-- 当前请求的资源 -->
Demand Resources: <memory:0, vCores:0>
<!-- 应用程序主节点(AM)当前正在使用的资源量 -->
AM Used Resources: <memory:0, vCores:0>
<!-- AM可以使用的最大资源量 -->
AM Max Resources: <memory:0, vCores:0>
<!-- 当前正在运行的应用程序数量 -->
Num Active Applications: 0
<!-- 当前正在等待资源的应用程序数量。 -->
Num Pending Applications: 0
<!-- 队列的最小资源保证 -->
Min Resources: <memory:2048, vCores:1>
<!-- 队列的最大资源限制 -->
Max Resources: <memory:5120, vCores:2>
<!-- 队列中单个容器可以分配的最大资源量 -->
Max Container Allocation: <memory:5120, vCores:2>
<!-- 为特定应用程序或用户保留的资源量 -->
Reserved Resources: <memory:0, vCores:0>
<!-- 最大运行个数 -->
Max Running Applications: 1
<!-- 队列在一段时间内(通常为30秒)的平均公平份额 -->
Steady Fair Share: <memory:5120, vCores:0>
<!-- 队列在当前时刻的公平份额 -->
Instantaneous Fair Share: <memory:0, vCores:0>
<!-- 指示队列中的应用程序是否可以被抢占以释放资源给其他应用程序 -->
Preemptable: true
source /etc/profile
stop-yarn.sh && start-yarn.sh
🔗 Links
hadoop yarn调度规则
https://ispong.isxcode.com/hadoop/hadoop/hadoop yarn调度规则/