yarn启用公平调度器后,将任务提交到offline队列卡住问题

目录

1.多资源队列配置

2.指定队列提交任务


 1.多资源队列配置

        1)启用公平调度器

        公平调度器的使用由属性yarn.resourcemanager.scheduler.class的设置决定,YARN默认使用的是容量调度器,如果要使用公平调度器,需要将yarn-site.xml文件中的yarn.resourcemanager.scheduler.class设置为公平调度器的完全限定名,其核心配置如下。

<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>/home/hadoop1/app/hadoop/etc/hadoop/conf/fair-scheduler.xml</value>
<!--指定Fair Scheduler 具体配置文件位置-->
</property>

        2)队列配置

        通过一个名为fair-scheduler.xml 的配置文件对公平调度器进行配置,该文件位于yarn.scheduler.fair.allocation.file 属性配置的路径下,其核心配置如下。

<?xml version="1.0"?>
<allocations>
	<queue name="root">
	  <schedulingPolicy>fair</schedulingPolicy>
	  <aclSubmitApps>*</aclSubmitApps>
	  <aclAdministerApps>*</aclAdministerApps>
	 <queue name="default">
		<minResources>1024mb, 1vcores</minResources>
		<maxResources>4096mb, 4vcores</maxResources>
	 </queue>
	 <queue name="offline">
		<minResources>1024mb, 1vcores</minResources>
		<maxResources>2048mb, 2vcores</maxResources>
		<maxRunningApps>50</maxRunningApps>
	 </queue>
	 <queue name="realtime">
		<minResources>1024mb, 1vcores</minResources>
		<maxResources>2048mb, 2vcores</maxResources>
		<maxRunningApps>50</maxRunningApps>
	 </queue>
	</queue>
</allocations>

2.指定队列提交任务

首先重启yarn集群,然后以Hadoop自带的wordcount为例,使用公平调度器将mapreduce应用提交到root.offline队列中运行,具体操作如下。

 bin/yarn jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.10.1.jar wordcount -Dmapreduce.job.queuename=root.offline /test/words.log /test/output4
<--输出路径随意,只要不存在即可-->

执行命令后发现任务卡在了Running Job 那里,检查问题发现是设置的队列资源过小,将资源调大即可,具体操作为将offline队列的maxResource变为4096mb。

<queue name="offline">
		<minResources>1024mb, 1vcores</minResources>
		<maxResources>4096mb, 2vcores</maxResources>
		<maxRunningApps>50</maxRunningApps>
</queue>

更改配置后重启yarn集群,重新运行任务成功。

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值