hadoop3.x yarn 资源调度(Scheduler和队列) 作者:马育民 • 2021-04-16 07:11 • 阅读:10318 # 说明 在集群中,资源是有限的,在 [hadoop3.x yarn工作流程](https://www.malaoshi.top/show_1IX2EWMFEPjo.html "hadoop3.x yarn工作流程") 中的第四步,`ApplicationMaster` 向 `ResourceManager` 申请资源,yarn 根据一些策略,为其分配资源 负责分配资源的是 `Scheduler` ,是 RM 的核心组件之一 ### 三种调度器 Hadoop调度器主要有三种: - FIFO Scheduler,先进先出调度器 - Capacity Scheduler,容量调度器 - Fair Scheduler,公平调度器 Apache Hadoop3.x 默认的资源调度器是 `Capacity Scheduler` CDH Hadoop3 默认调度器是 `Fair Scheduler` # 配置调度器 yarn-site.xml文件 ``` yarn.resourcemanager.scheduler.class org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler ``` # WEB中查看调度器 访问:http://hadoop2:8088/ ,显示如下: [![](http://65242847.gitee.io/pic/hadoop/Snipaste_2021-11-16_07-32-03.png)](http://65242847.gitee.io/pic/hadoop/Snipaste_2021-11-16_07-32-03.png) # 队列 用户提交的任务,yarn放在队列(Queue)中 **Schedule 是根据策略,给队列中的任务,分配资源** 默认只有一个可用的队列 ### WEB中查看工作队列 当运行任务时: ``` hadoop jar /program/hadoop-3.0.3/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.0.3.jar wordcount /data /result6 ``` 下图红框中就会变成 绿色 [![](http://65242847.gitee.io/pic/hadoop/Snipaste_2021-11-16_07-40-25.png)](http://65242847.gitee.io/pic/hadoop/Snipaste_2021-11-16_07-40-25.png) 原文出处:http://malaoshi.top/show_1IX2Egfcu0Uc.html