${HADOOP_HOME}/etc/hadoop/yarn-site.xml
to enable Capacity Scheduler first:<property><name>yarn.resourcemanager.scheduler.class</name><value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler</value></property>
yarn.scheduler.capacity.root
to specify the predefined root queue of Capacity Scheduler in ${HADOOP_HOME}/etc/hadoop/capacity-scheduler.xml
. All other queues are subqueues of the root queue. All queues are organized in a tree structure. Set yarn.scheduler.capacity.<queue-path>.queues
to specify subqueues under queue-path
and separate different subqueues by commas (,).<property><name>yarn.scheduler.capacity.root.queues</name><value>q1,q2,q3</value></property><property><name>yarn.scheduler.capacity.root.q1.queues</name><value>q11,q12</value></property><property><name>yarn.scheduler.capacity.root.q2.queues</name><value>q21,q22</value></property>
conf/yarn-site.xml
:<property><name>yarn.node-labels.fs-store.root-dir</name><value>hdfs://namenode:port/path-to-store/node-labels/</value></property><property><name>yarn.node-labels.enabled</name><value>true</value></property><property><name>yarn.node-labels.configuration-type</name><value>centralized or delegated-centralized or distributed</value></property>
yarn.node-labels.fs-store.root-dir
is created and that ResourceManager has access to it.file://home/yarn/node-label
. However, to ensure high availability of the cluster and to avoid label loss due to the failure of ResourceManager, we recommend that you store node labels in HDFS.yarn.node-labels.configuration-type
.etc/hadoop/capacity-scheduler.xml
.Configuration Item | Description |
yarn.scheduler.capacity. <queue-path> .capacity | The percentage of nodes in the DEFAULT partition that are accessible to a queue. The values of this configuration item of all direct subqueues under each parent queue must sum up to 100. |
yarn.scheduler.capacity. <queue-path> .accessible-node-labels | A list of labels that are accessible to a queue. Labels are separated by commas (,). For example, "HBASE,STORM" specifies that the queue can access the HBASE and STORM labels. All queues can access nodes without labels. If this configuration item is not specified for a queue, the queue inherits the value from its parent queue. If you want a queue to access only nodes without labels, leave this configuration item unspecified. |
yarn.scheduler.capacity. <queue-path> .accessible-node-labels.<label> .capacity | The percentage of nodes in the <label> partition that are accessible to a queue. The values of this configuration item of all direct subqueues under each parent queue must sum up to 100. The default value is 0. |
yarn.scheduler.capacity. <queue-path> .accessible-node-labels.<label> .maximum-capacity | Similar to yarn.scheduler.capacity. <queue-path> .maximum-capacity of Capacity Scheduler, this configuration item specifies the maximum percentage of nodes in the <label> partition that are accessible to a queue. The default value is 100. |
yarn.scheduler.capacity. <queue-path> .default-node-label-expression | If no node label is specified in a resource request, applications are submitted to the partition specified by this configuration item. By default, the value is empty, which indicates that containers on nodes without a label are assigned to the applications. |
yarn-site.xml
, save the changes, and restart all YARN components. On the Role Management tab, confirm the IP address of the node where the ResourceManager service is located. Then, switch to the Configuration Management tab to modify relevant parameters in yarn-site.xml
, save the changes, and restart all YARN components.yarn.resourcemanager.scheduler.class
parameter in yarn-site.xml
on the selected node.core-site.xml
.
yarn-site.xml
for the master node and then restart ResourceManager.
yarn rmadmin -addToClusterNodeLabels
command to add labels.
yarn rmadmin -replaceLabelsOnNode
command to label nodes.
Capacity-Scheduler.xml
to configure the cluster queues, resource percentages of queues, and labels accessible to queues. Example:<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><configuration><property><name>yarn.scheduler.capacity.maximum-am-resource-percent</name><value>0.8</value></property><property><name>yarn.scheduler.capacity.maximum-applications</name><value>1000</value></property><property><name>yarn.scheduler.capacity.root.queues</name><value>default,dev,product</value></property><property><name>yarn.scheduler.capacity.root.default.capacity</name><value>20</value></property><property><name>yarn.scheduler.capacity.root.dev.capacity</name><value>40</value></property><property><name>yarn.scheduler.capacity.root.product.capacity</name><value>40</value></property><property><name>yarn.scheduler.capacity.root.accessible-node-labels.cpu.capacity</name><value>100</value></property><property><name>yarn.scheduler.capacity.root.accessible-node-labels.normal.capacity</name><value>100</value></property><property><name>yarn.scheduler.capacity.root.accessible-node-labels</name><value>*</value></property><property><name>yarn.scheduler.capacity.root.dev.accessible-node-labels.normal.capacity</name><value>100</value></property><property><name>yarn.scheduler.capacity.root.product.accessible-node-labels.cpu.capacity</name><value>100</value></property><property><name>yarn.scheduler.capacity.root.dev.accessible-node-labels</name><value>normal</value></property><property><name>yarn.scheduler.capacity.root.dev.default-node-label-expression</name><value>normal</value></property><property><name>yarn.scheduler.capacity.root.product.accessible-node-labels</name><value>cpu</value></property><property><name>yarn.scheduler.capacity.root.product.default-node-label-expression</name><value>cpu</value></property><property><name>yarn.scheduler.capacity.normal.sharable-partitions</name><value>cpu</value></property><property><name>yarn.scheduler.capacity.normal.require-other-partition-resource</name><value>true</value></property><property><name>yarn.scheduler.capacity.cpu.sharable-partitions</name><value></value></property><property><name>yarn.scheduler.capacity.cpu.require-other-partition-resource</name><value>true</value></property></configuration>
[hadoop@172 hadoop]$ cd /usr/local/service/hadoop[hadoop@172 hadoop]$ yarn jar ./share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.8.4-tests.jar sleep -Dmapreduce.job.queuename=product -m 32 -mt 1000
[hadoop@172 hadoop]$ cd /usr/local/service/hadoop[hadoop@172 hadoop]$ yarn jar ./share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.8.4-tests.jar sleep -Dmapreduce.job.queuename=dev -m 32 -mt 1000
Was this page helpful?