|
当前yarn(hadoop 2.0.2-alpha)上的调度器
ResourceManager初始化时创建scheduler, 默认使用FifoScheduler(现在默认调度器已经改为capacity scheduler)
protected ResourceScheduler createScheduler() {
return ReflectionUtils.newInstance(this.conf.getClass(
YarnConfiguration.RM_SCHEDULER, FifoScheduler.class,
ResourceScheduler.class), this.conf);
}
Capacity Scheduler
官网的介绍:
http://hadoop.apache.org/docs/r0.23.0/hadoop-yarn/hadoop-yarn-site/CapacityScheduler.html
目的: 一个用在hadoop中插件试的调度器, 允许多种租户安全的共享一个大集群, 以此使他们的应用能在约束条件下及时到分配资源, 设计于共享, 多用户, 操作友好, 最大化集群吞吐量和利用率
Capacity调度器的配置
在 etc/hadoop/capacity-scheduler.xml增加配置.
组分层信息解释: 顶层为root, 每个节点下的子节点和为100, 百分比的意思.
配置a,b,c组, a组下有a1组和a2组:
yarn.scheduler.capacity.root.capacity
100
yarn.scheduler.capacity.root.a.capacity
30
yarn.scheduler.capacity.root.a.a1.capacity
30
yarn.scheduler.capacity.root.a.a2.capacity
70
yarn.scheduler.capacity.root.b.capacity
30
yarn.scheduler.capacity.root.c.capacity
40
yarn.scheduler.capacity.root.queues
a,b,c
The queues at the this level (root is the root queue).
yarn.scheduler.capacity.root.a.queues
a1,a2
The queues at the this level (root is the root queue).
客户端配置在 etc/hadoop/mapred-site.xml中配置组信息:
mapreduce.job.queuename
a1
mapred-default.xml
默认组为default,
提交作业: bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-0.23.3.jar teragen 100 /in. 作业会运行在a1下.
下图是对配置文件的图形解释:
ParentQueue: root, a
LeafQueue: b,c,a1,a2
下图RM网页上显示了组关系:
Capacity Scheduler包:
其中接口CSQueue(Capacity Scheduler Queue)接口, 定义了一个组结点(树形)应该提供的方法, 它的两个实现LeafQueue(叶子组)和ParentQueue(双亲组), 客户端提交的作业需要提交到叶子组.
Capacity初始化期间读取配置组信息, 维护queue队列, 提交作业时运行handle方法, 状态为APP_ADDED, 在addApplication方法中通过配置的组名获取组信息,如果为null则报错. 然后判断是否能提交到该组(queue.submitApplication LeafQueue).
判断流程:
1. HasAccess, queue初始化的时候更新acl信息, 然后通过它判断某用户是否能使用该组资源
2. 该组是否处于running状态
3. Maxapplication, 组是否超过, 用户是否超过, 即支持设置每个组(用户)能运行的最多App数, 资源比例.
转载请注明出处!(http://www.iyunv.com/shenh062326/archive/2012/11/20/yarn_capacity_scheduler.html) |
|
|