YARN Node Labels =============== Overview -------- Node label is a way to group nodes with similar characteristics and applications can specify where to run. Now we only support node partition, which is: * One node can have only one node partition, so a cluster is partitioned to several disjoint sub-clusters by node partitions. By default, nodes belong to DEFAULT partition (partition="") * User need to configure how much resources of each partition can be used by different queues. For more detail, please refer next section. * There are two kinds of node partitions: * Exclusive: containers will be allocated to nodes with exactly match node partition. (e.g. asking partition=“x” will be allocated to node with partition=“x”, asking DEFAULT partition will be allocated to DEFAULT partition nodes). * Non-exclusive: if a partition is non-exclusive, it shares idle resource to container requesting DEFAULT partition. User can specify set of node labels which can be accessed by each queue, one application can only use subset of node labels that can be accessed by the queue which contains the application. Features -------- The ```Node Labels``` supports the following features for now: * Partition cluster - each node can be assigned one label, so the cluster will be divided to several smaller disjoint partitions. * ACL of node-labels on queues - user can set accessible node labels on each queue so only some nodes can only be accessed by specific queues. * Specify percentage of resource of a partition which can be accessed by a queue - user can set percentage like: queue A can access 30% of resources on nodes with label=hbase. Such percentage setting will be consistent with existing resource manager * Specify required node label in resource request, it will only be allocated when node has the same label. If no node label requirement specified, such Resource Request will only be allocated on nodes belong to DEFAULT partition. * Operability * Node labels and node labels mapping can be recovered across RM restart * Update node labels - admin can update labels on nodes and labels on queues when RM is running * Mapping of NM to node labels can be done in three ways, but in all of the approaches Partition Label should be one among the valid node labels list configured in the RM. * **Centralized :** Node to labels mapping can be done through RM exposed CLI, REST or RPC. * **Distributed :** Node to labels mapping will be set by a configured Node Labels Provider in NM. We have two different providers in YARN: *Script* based provider and *Configuration* based provider. In case of script, NM can be configured with a script path and the script can emit the labels of the node. In case of config, node Labels can be directly configured in the NM's yarn-site.xml. In both of these options dynamic refresh of the label mapping is supported. * **Delegated-Centralized :** Node to labels mapping will be set by a configured Node Labels Provider in RM. This would be helpful when label mapping cannot be provided by each node due to security concerns and to avoid interaction through RM Interfaces for each node in a large cluster. Labels will be fetched from this interface during NM registration and periodical refresh is also supported. Configuration ------------- ###Setting up ResourceManager to enable Node Labels Setup following properties in ```yarn-site.xml``` Property | Value --- | ---- yarn.node-labels.fs-store.root-dir | hdfs://namenode:port/path/to/store/node-labels/ yarn.node-labels.enabled | true yarn.node-labels.configuration-type | Set configuration type for node labels. Administrators can specify “centralized”, “delegated-centralized” or “distributed”. Default value is “centralized”. Notes: * Make sure ```yarn.node-labels.fs-store.root-dir``` is created and ```ResourceManager``` has permission to access it. (Typically from “yarn” user) * If user want to store node label to local file system of RM (instead of HDFS), paths like `file:///home/yarn/node-label` can be used ###Add/modify node labels list to YARN * Add cluster node labels list: * Executing ```yarn rmadmin -addToClusterNodeLabels "label_1(exclusive=true/false),label_2(exclusive=true/false)"``` to add node label. * If user don’t specify “(exclusive=…)”, exclusive will be ```true``` by default. * Run ```yarn cluster --list-node-labels``` to check added node labels are visible in the cluster. ###Remove node labels from YARN * Remove cluster node labels: * To remove one or more node labels, execute the following command: ```yarn rmadmin -removeFromClusterNodeLabels "