Using Node Labels to Schedule YARN Applications

About this task

To set up node labels for the purpose of scheduling YARN applications (including MapReduce applications) on a specific node or group of nodes:

Procedure

  1. Enable the labels by using the following steps:
    1. Add the yarn.node-labels.enabled parameter to the yarn-site.xml file:
      <property>
        <name>yarn.node-labels.enabled</name>
        <value>true</value>
      </property>
    2. Restart the ResourceManager (RM):
      /opt/mapr/bin/maprcli node services -name resourcemanager -nodes <node names> -action restart
  2. Add labels to clusters and nodes:
    yarn rmadmin -addToClusterNodeLabels "label3, label4"
    yarn rmadmin -replaceLabelsOnNode "node3.cluster.com:8099=label3 node4.cluster.com:8099=label4"
  3. To gather information about the labels, use any of the following commands:
    • To list the node labels:
      yarn cluster --list-node-labels
      Node Labels: <label4:exclusivity=true>,<label3:exclusivity=true>
    • To reload the queues, states, and scheduler-specific properties:
      yarn rmadmin -refreshQueues
    • To show the node status:
      yarn node -status node3.cluster.com:8099
      Node Report :
              Node-Id : node3.cluster.com:8099
              Rack : /default-rack
              Node-State : RUNNING
              Node-Http-Address : node3.cluster.com:8044
              Last-Health-Update : Tue 24/Jan/23 03:16:07:88UTC
              Health-Report :
              Containers : 0
              Memory-Used : 0MB
              Memory-Capacity : 45744MB
              CPU-Used : 0 vcores
              CPU-Capacity : 40 vcores
              Node-Labels : label3
              Node Attributes :
              Resource Utilization by Node : PMem:21544 MB, VMem:21544 MB, VCores:2.6766665
              Resource Utilization by Containers : PMem:0 MB, VMem:0 MB, VCores:0.0