`
han_zw
  • 浏览: 171709 次
  • 性别: Icon_minigender_1
  • 来自: 天津
社区版块
存档分类
最新评论

hadoop 2.7.2 yarn中文文档——YARN Node Labels

 
阅读更多
概述
Node label是将相似特点的节点进行分组的一种途径,application可以指定在哪里运行。现在我们只支持node partition:
  • 一个node只能有一个node partition, 所以一个集群通过node partition被分为多个互斥的子集群。默认的,node都属于DEFAULT分区(partition="")。
  • 用户需要配置每个partition可以使用不同的队列多少资源。更多详情请参考下面的章节。
  • 有两种node partition:
  • 互斥的:容器被分配到精确匹配的node partition的节点(如请求partition="x" 将会被分配到partition="x"的节点,请求DEFAULT partition将会被分配到DEFAULT 分区的节点。
  • 非互斥的:如果一个partition是非互斥的,那么它共享闲置的资源给请求DEFAULT partition的容器。
用户可以指定能被每一个队列访问的node label集,一个application只能使用所属队列能够访问的node label的子集。
 
特性
目前Node Labels支持以下特性:
  • Partition cluster - 每个node可以指定一个label,所以集群将会被分为多个小的互斥的partition。
  • ACL of node-labels on queues - 用户能够设置每个队列可访问的node label,所以只有某些node可以被特定队列访问。
  • 指定可以被队列访问的partition的资源百分比- 用户可以设置像这样的百分比:队列A可以访问具备lable=hbase label的node30%的资源。这样的百分比设置将会与现存的资源管理器保持一致。
  • 在资源请求中指定必需的Node Label,它将会被分配到具有相同label的node。如果没有指定必需的node label,那么资源请求将会被分配到属于DEFAULT partition的node。
  • 可运维性
  • Node Label和节点的标签映射可以在RM restart中恢复。
  • Update node labels -更新node label-管理员可以在RM运行过程中更新node、队列的labels。
 
配置信息
设置ResourceManager以启用Node Label:
在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.fs-store.root-dir是已经创建的,并且ResourceManager有权限访问。
  • 如果用户想要存储node label到本地文件系统(替换hdfs),可以使用类似这样路径file:///home/yarn/node-label。
增加/修改node label列表以及node-to-labels映射
  • 新增集群node label列表:
  • 执行yarn rmadmin -addToClusterNodeLabels "label_1(exclusive=true/false),label_2(exclusive=true/false)" 进行node label添加。
  • 如果用户没有指定“(exclusive=…)”,execlusive 默认为true.
  • 运行 yarn cluster --list-node-labels 检查添加的node labels在集群中已经是可见的。
  • 添加label到node
  • 执行 yarn rmadmin -replaceLabelsOnNode “node1[:port]=label1 node2=label2”,增加label1到node1,label2到node2.如果用户没有指定port,它将会添加到运行在node上的所有NodeManager。
调度器与node label相关的配置项
Capacity Scheduler 配置
Property Value
yarn.scheduler.capacity.<queue-path>.capacity 设置相应队列能够访问属于DEFAULT partition的节点的capacity百分比。每个parent之下的所有直接children的DEFAULT capacity总和必须是100.
yarn.scheduler.capacity.<queue-path>.accessible-node-labels 管理员需要指定每个队列能够访问的label,以英文逗号分隔,像这种形式;“hbase,storm” 表示队列能够访问hbase和storm label。所有队列都能访问没有label的node,用户不需要额外指定。如果用户没有指定该字段,它将会从parent继承。如果用户想明确指定一个队列只能访问没有label的node,只需要设置空格作为值。
yarn.scheduler.capacity.<queue-path>.accessible-node-labels.<label>.capacity 设置队列能够访问<label> partition的node的百分比。每个父节点下直接children的<label> capacities的总和必须是100.默认是0.
yarn.scheduler.capacity.<queue-path>.accessible-node-labels.<label>.maximum-capacity 类似于yarn.scheduler.capacity.<queue-path>.maximum-capacity,它是每个队列对于label的maximum-capacity。默认值是100.
yarn.scheduler.capacity.<queue-path>.default-node-label-expression 值类似于"hbase",它的意思是:如果提交到队列的application,在其资源请求中没有指定node label,它会使用hbase作为default-node-label-expression。默认值为空,所以application会从没有node label的节点中获取容器。
node label配置的示例:
假定我们有这样一个队列结构
                root
            /     |    \
     engineer    sales  marketing
我们在集群中有5个node(hostname=h1..h5),其中的每一个有24G memory,24vcores。5个node之中的1个有GPU(假定是h5).所以管理员增加GPU label到h5.
Assume user have a Capacity Scheduler configuration like: (key=value is used here for readability)
假定用户的Capacity Scheduler配置如下: (此处的key=value处于可读性考虑)
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
你可以看到 root.engineering/marketing/sales.capacity=33,所以它们其中的每一个授权具有partition的1/3的资源。所以它们中的每一个能够使用h1..h4的1/3的资源,也就是24 * 4 * (1/3) = (32G mem, 32 v-cores)。另外只有engineering/marketing队列有权限访问GPU partition。
engineering/marketing中的每一个被授权具有partition=GPU label的资源的1/2.所以它们之中的每一个能够使用h5资源的1/2,也就是 24 * 0.5 = (12G mem, 12 v-cores).
备注:
  • 完成CapacityScheduler的配置之后,执行yarn rmadmin -refreshQueues使变更生效。
  • 到RM Web UI的调度页面检查你的配置是否成功设置。
 
为application指定node label
application可以使用如下Java APIs指定请求的node label。(API的描述就不翻译了)
  • ApplicationSubmissionContext.setNodeLabelExpression(..) to set node label expression for all containers of the application.
  • ResourceRequest.setNodeLabelExpression(..) to set node label expression for individual resource requests. This can overwrite node label expression set in ApplicationSubmissionContext
  • Specify setAMContainerResourceRequest.setNodeLabelExpression in ApplicationSubmissionContext to indicate expected node label for application master container.
监控
通过Web UI监控
通过web UI可以看到以下label相关的字段:
通过命令行监控
  • 使用yarn cluster --list-node-labels 获取集群中的label
  • 使用yarn node -status <NodeId> 获取指定node的状态,状态信息包含labels

下一篇:hadoop 2.7.2 yarn中文文档——Web Application Proxy

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics