Yarn配置调度__公平调度器

一、介绍

  • 类名:容量调度器
  • org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler
  • 配置文件
    • 调度器级别的配置:在yarn-site.xml中
    • 队列级别的配置:放在单独的文件中,文件名由yarn.scheduler.fair.allocation.file指定

二、配置项解析

  • 调度器级别的配置

    # 指定队列级别的配置项所在的文件名
    yarn.scheduler.fair.allocation.file
    # 如果为true,在提交job没指定队列时,则会以用户名自动创建队列
    yarn.scheduler.fair.user-as-default-queue
    # 如果为true,就可以为指定的队列不存在的job自动创建队列
    yarn.scheduler.fair.allow-undeclared-pools
    # 是否自动根据job的大小来计算他的比重
    yarn.scheduler.fair.sizebasedweight
    # 一个容器最多可以使用的内存数量
    yarn.scheduler.maximum-allocation
    # 一个容器最多可以使用的虚拟CPU数量
    yarn.scheduler.maximum-allocation-vcores
    
  • 队列级别的配置举例

    # 一个队列需要的最少资源
    minResources
    # 一个队列最多能使用的资源
    maxResources
    # 一个队列所分配的一个容器最多可使用的资源量
    maxContainerAllocation
    # 可以分配为临时子队列的最大资源量
    maxChildResources
    # 一个队列中对多能同时运行的job数量
    maxRunningApps
    # 一个job的ApplicationMaster在一个队列中可以占用的最大资源比例
    maxAMShare
    # 一个队列的比重
    weight
    # 可以提交job到本队列的用户或组的列表
    aclSubmitApps
    # 队列内的调度策略
    schedulingPolicy
    

三、实例解析

<?xml version="1.0"?>
<allocations>
	<!-- 定义一个根队列,名叫sample_queue -->
	<queue name="sample_queue">
		<minResources>10000 mb, 0vcores</minResources>
		<maxResources>90000 mb, 0vcores</maxResources>
		<maxRunningApps>50</maxRunningApps>
		<maxAMShare>0.1</maxAMShare>
		<weight>2.0</weight>
		<schedulingPolicy>fair</schedulingPolicy>
		<!-- 定义一个子队列 -->
		<queue name="sample_sub_queue">
			<aclSubmitApps>charlie</aclSubmitApps>
			<minResources>5000 mb, 0vcores</minResources>
		</queue>
		<!-- 再定义一个子队列 -->
		<queue name="sample_reservable_queue">
			<reservation></reservation>
		</queue>
	</queue>
	
	<queueMaxAMShareDefault>0.5</queueMaxAMShareDefault>
	<queueMaxResourcesDefault>40000mb, 0vcores</queueMaxResourcesDefault>
	
	<!-- 定义次队列是为了作为自动创建的队列的容器,类型为parent表示不是叶子队列 -->
	<queue name="secondary_group_queue" type="parent">
		<weight>3.0</weight>
		<maxChildResources>4096 mb, 4vcores</maxChildResources>
	</queue>
	
	<user name="sample_user">
		<maxRunningApps>30</maxRunningApps>
	</user>
	<userMaxAppsDefault>5</userMaxAppsDefault>
	<!-- 列出一些规则,根据这些规则决定将一个job放在哪个队列中 -->
	<queuePlacementPolicy>
		<rule name="specified" />
		<rule name="primaryGroup" create="false" />
		<rule name="nestedUserQueue">
			<rule name="secondaryGroupExistingQueue" create="false" />
		</rule>
		<rule name="default" queue="sample_queue"/>
	</queuePlacementPolicy>
</allocations>
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值