一、[Yarn租户资源隔离配置资源调度多]
### --- Yarn多租户资源隔离配置 ~~~ Yarn集群资源设置为A,B两个队列, ~~~ A队列设置占用70%的资源,主要用于运行常规定时任务, ~~~ B队列设置占用资源30%主要运行临时任务, ~~~ 如果A队列资源占满,两个队列之间可以共享资源。B队列资源丰富, ~~~ A队列可以利用B队列的资源,最大限度地利用整体资源. ~~~ 选择使用Fair Scheduler调度策略!!
二、具体配置
### --- yarn-site.xml [root@linux121 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/yarn-site.xml <!-- 指定我们的任务调度和使用fairScheduler的调度方式 --> <property> <name>yarn.resourcemanager.scheduler.class</name> <value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler</value> <description>In case you do not want to use the defaultscheduler</description> </property> ### --- 发送到其它节点 [root@linux121 ~]# rsync-script /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/yarn-site.xml
### --- 创建fair-scheduler.xml文件 ~~~ 在Hadoop安装目录/etc/hadoop创建该文件 ~~~ # 创建fair-scheduler.xml文件 [root@linux121 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/fair-scheduler.xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <allocations> <defaultQueueSchedulingPolicy>fair</defaultQueueSchedulingPolicy> <queue name="root" > <queue name="default"> <aclAdministerApps>*</aclAdministerApps> <aclSubmitApps>*</aclSubmitApps> <maxResources>9216 mb,4 vcores</maxResources> <maxRunningApps>100</maxRunningApps> <minResources>1024 mb,1vcores</minResources> <minSharePreemptionTimeout>1000</minSharePreemptionTimeout> <schedulingPolicy>fair</schedulingPolicy> <weight>7</weight> </queue> <queue name="queue1"> <aclAdministerApps>*</aclAdministerApps> <aclSubmitApps>*</aclSubmitApps> <maxResources>4096 mb,4vcores</maxResources> <maxRunningApps>5</maxRunningApps> <minResources>1024 mb, 1vcores</minResources> <minSharePreemptionTimeout>1000</minSharePreemptionTimeout> <schedulingPolicy>fair</schedulingPolicy> <weight>3</weight> </queue> </queue> <queuePlacementPolicy> <rule create="false" name="specified"/> <rule create="true" name="default"/> </queuePlacementPolicy> </allocations> ### --- 发送到其它节点 [root@linux121 ~]# rsync-script /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/fair-scheduler.xml
### --- 重启yarn集群 [root@linux123 ~]# stop-yarn.sh [root@linux123 ~]# start-yarn.sh
三、界面验证http://linux123:8088/cluster/scheduler:Scheduler
