1. 程式人生 > >YARN學習總結-第十二節-YARN-Node-Labels

YARN學習總結-第十二節-YARN-Node-Labels

YARN-Node-Labels

目前,我們只支援節點分割槽:

1.一個節點只能有一個分割槽,可以通過分割槽,將節點分為不相交的子叢集,目前,預設的分割槽為partition=""

2.使用者需要配置每個分割槽的資源是如何被不同的佇列使用的。

3.有兩種節點分割槽:

Exclusive:只有節點明確匹配分割槽,才會分配容器。

Non-exclusive:

使用者可以指定一些可以被佇列訪問的標籤,應用只能使用分配給佇列的標籤的子集。

節點標籤目前支援以下功能:

Partition cluster:劃分叢集。

ACL of node-labels on queues:

指定分割槽的資源百分比,分配給某個佇列。

在資源請求時,指定節點標籤,容器只會分配到指定標籤的節點。

RM重啟後,節點標籤和節點標籤對映可以被過載。

管理員可以在執行時更新節點標籤。

配置Node Labels

yarn.node-labels.fs-store.root-dir

yarn.node-labels.enabled

yarn.node-labels.configuartion-type:centralized,delegated-centralized,distributed,預設值為centrialized。

注意:yarn.node-labels.fs-store.root-dir被建立並且RM可以訪問,一般為yarn使用者

如果是儲存標籤到本地檔案系統,可以指定路徑:file:///home/yarn/node-label

yarn rmadmin -addToClusterNodeLabels label1(exclusive=true/false),label2(exclusive=true/false)

yarn cluster --list-node-labels

yarn rmadmin -removeFromClusterNodeLabels <label>

不允許已經關聯到佇列的標籤

yarn cluster --list-node-labels

在Centralized模式下配置節點標籤對映:

yarn rmadmin -replaceLabelOnNode node1:port=label1 node2=label2 [-failOnUnknownNodes] 如果不指定埠,則新增標籤到NM執行所在節點。

在Distributed模式下配置節點標籤對映:

yarn.node-labels.configuration-type

yarn.nodemanager.node-labels.provider:可選的配置有connfig,script,class name。

yarn.nodemanager.node-labels.resync-interval-ms:預設為2min

yarn.nodemanager.node-labels.provider.fetch-interval-ms:

yarn.nodemanager.node-labels.provider.fetch-timeout-ms:

yarn.nodemanager.node-labels.provider.script.path

yarn.nodemanager.node-labels.provider.configured-node-partition

在Delegated-Centralized模式下配置節點標籤對映:

yarn.node-labels.configuration-type

yarn.resourcemanager.node-labels.provider

yarn.resourcemanager.node-labels.provider.fetch.interval-ms

配置排程器設定節點標籤

yarn.scheduler.capacity.<queue-path>.capacity

yarn.scheduler.capacity.<queue-path>.accessible-node-labels:配置可以訪問的標籤列表。

yarn.scheduler.capacity.<queue-path>.accessible-node-labels.<label>.capacity

yarn.scheduler.capacity.<queue-path>.accessible-node-labels.<label>.maximum-capacity:預設是100

yarn.scheduler.capacity.<queue-path>.default-node-label-expression

案例:

                root
            /     |    \
     engineer    sales  marketing

We have 5 nodes (hostname=h1..h5) in the cluster, each of them has 24G memory, 24 vcores. 1 among the 5 nodes has GPU (assume it’s h5). So admin added GPU label to h5.

Assume user have a Capacity Scheduler configuration like: (key=value is used here for readability)

yarn.scheduler.capacity.root.queues=engineering,marketing,sales
yarn.scheduler.capacity.root.engineering.capacity=33
yarn.scheduler.capacity.root.marketing.capacity=34
yarn.scheduler.capacity.root.sales.capacity=33

yarn.scheduler.capacity.root.engineering.accessible-node-labels=GPU
yarn.scheduler.capacity.root.marketing.accessible-node-labels=GPU

yarn.scheduler.capacity.root.engineering.accessible-node-labels.GPU.capacity=50
yarn.scheduler.capacity.root.marketing.accessible-node-labels.GPU.capacity=50

yarn.scheduler.capacity.root.engineering.default-node-label-expression=GPU

執行,yarn rmadmin -refreshQueues 應用改變

應用如何指定節點標籤

ApplicationSubmissionContext.setNodeLabelExpression(..) 

ResourceRequest.setNodeLabelExpression(..)

setAMContainerResourceRequest.setNodeLabelExpression

監控:

yarn cluster --list-node-labels

yarn node -status <NodeId>