【yarn node label】yarn node label设置presto主节点(接上一篇)

4 篇文章 0 订阅

接上篇【presto on yarn】解决方案-CSDN博客,安装好presto on yarn之后,presto集群的coordinator主节点是由yarn自动分配的,那么每次访问presto的时候地址都会变,在程序中就没法固定presto的连接参数,此问题可以由yarn node label来解决

使用node label需要结合yarn的队列功能。

一.CapacityScheduler

Capacity Scheduler是一个hadoop支持的可插拔的资源调度器,它允许多租户安全的共享集群资源,它们的applications在容量限制之下,可以及时的分配资源。使用操作友好的方式运行hadoop应用,同时最大化吞吐能力和集群利用率。
Capacity Scheduler提供的核心理念就是Queues(队列),这些queues通常有管理员设定。为了在共享资源上,提供更多的控制和预见性,Capacity Scheduler支持多级queue,以确保在其他queues允许使用空闲资源之前,资源可以在一个组织的sub-queues之间共享

找到hadoop/conf/capacity-scheduler.xml,配置队列相关的参数。因为我们环境是用ambri管理的,参数配置都在ui上

我的原始参数如下

yarn.scheduler.capacity.default.minimum-user-limit-percent=100
yarn.scheduler.capacity.maximum-am-resource-percent=0.2
yarn.scheduler.capacity.maximum-applications=10000
yarn.scheduler.capacity.node-locality-delay=40
yarn.scheduler.capacity.root.accessible-node-labels=*
yarn.scheduler.capacity.root.acl_administer_queue=*
yarn.scheduler.capacity.root.capacity=100
yarn.scheduler.capacity.root.default.acl_administer_jobs=*
yarn.scheduler.capacity.root.default.acl_submit_applications=*
yarn.scheduler.capacity.root.default.capacity=100
yarn.scheduler.capacity.root.default.maximum-capacity=100
yarn.scheduler.capacity.root.default.state=RUNNING
yarn.scheduler.capacity.root.default.user-limit-factor=1
yarn.scheduler.capacity.root.queues=default

root是所有队列的父节点,在root下可以定义子节点及多级节点队列

yarn.scheduler.capacity.root.queues=default 默认定义了default队列,需要定义多个,后面值用逗号分隔如“default,apple,hive”

yarn.scheduler.capacity.root.default.capacity=75 定义default队列使用的最大容量,75表示75%。该值需要满足一个要求,即某个父节点下所有的队列该值加起来必须为100.如default=25,apple=35,hive=40

yarn.scheduler.capacity.root.default.maximum-capacity=100 定义default队列最大可使用容量,该值要大于上面的值

其他参数的含义具体去百度。

二.Node Label

Node label是将相似特点的节点进行分组的一种途径,application可以指定在哪里运行。就是为每个节点打上特定的标签,使得具体应用可控制的分配到某个活某些节点上运行。

本例就需要将presto的coordinator主节点固定到某一个节点上,其他节点部署worker

首先在CapacityScheduler定义node label相关参数,我定义的参数如下

yarn.scheduler.capacity.default.minimum-user-limit-percent=100
yarn.scheduler.capacity.maximum-am-resource-percent=0.2
yarn.scheduler.capacity.maximum-applications=10000
yarn.scheduler.capacity.node-locality-delay=40
yarn.scheduler.capacity.root.accessible-node-labels=*
yarn.scheduler.capacity.root.accessible-node-labels.coordinator.capacity=100
yarn.scheduler.capacity.root.accessible-node-labels.worker.capacity=100
yarn.scheduler.capacity.root.acl_administer_queue=*
yarn.scheduler.capacity.root.capacity=100
yarn.scheduler.capacity.root.default.accessible-node-labels=*
yarn.scheduler.capacity.root.default.accessible-node-labels.coordinator.capacity=100
yarn.scheduler.capacity.root.default.accessible-node-labels.worker.capacity=100
yarn.scheduler.capacity.root.default.acl_administer_jobs=*
yarn.scheduler.capacity.root.default.acl_submit_applications=*
yarn.scheduler.capacity.root.default.capacity=100
yarn.scheduler.capacity.root.default.default-node-label-expression=worker
yarn.scheduler.capacity.root.default.maximum-capacity=100
yarn.scheduler.capacity.root.default.state=RUNNING
yarn.scheduler.capacity.root.default.user-limit-factor=1
yarn.scheduler.capacity.root.queues=default

yarn.scheduler.capacity.root.accessible-node-labels=*  定义root队列可以进入的标签,*代表所有,即root队列可以使用任何标签的node。多个可以逗号分割如“coordinator,worker”

yarn.scheduler.capacity.root.accessible-node-labels.coordinator.capacity=100 定义root队列coordinator标签可使用集群的容量

yarn.scheduler.capacity.root.accessible-node-labels.worker.capacity=100 定义root队列worker标签可使用集群的容量

yarn.scheduler.capacity.root.default.accessible-node-labels=*  定义default队列可以进入的标签,*代表所有,即root队列可以使用任何标签的node。多个可以逗号分割如“coordinator,worker”

yarn.scheduler.capacity.root.default.accessible-node-labels.coordinator.capacity=100 定义default队列下coordinator标签可使用default队列的容量

yarn.scheduler.capacity.root.default.accessible-node-labels.worker.capacity=100 定义default队列下worker标签可使用default队列d的容量

yarn.scheduler.capacity.root.default.default-node-label-expression=worker 定义default队列默认使用的标签为worker。表示如果请求过来没有指定label,那么就使用worker这个label,它可以使用nodemanager里面标签是worker或者标签为空的节点。如果该值设置为空,则请求过来时没有指定label那就用空值,此时nodemanager只能使用标签为空的节点

参数设置好之后,需要重启yarn。

并刷新CapacityScheduler

然后在node集群设置node的label

1.首先在系统添加label:yarn rmadmin -addToClusterNodeLabels coordinator,worker

查看系统label命令:yarn cluster --list-node-labels

删除label命令:yarn rmadmin -removeFromClusterNodeLabels coordinator

2.设置节点label

查询node信息:yarn node --list

添加node label:yarn rmadmin -replaceLabelsOnNode t007.wux.chin.seagate.com:45454,coordinator

删除node label:yarn rmadmin -replaceLabelsOnNode t007.wux.chin.seagate.com:45454

查看node节点label:yarn node -status t007.wux.chin.seagate.com:45454

ui查看

三:问题

1.刷新CapacityScheduler时,Illegal capacity of 1.0 for children of queue root for label=coordinator

需要同时设置

yarn.scheduler.capacity.root.accessible-node-labels.coordinator.capacity=100

yarn.scheduler.capacity.root.accessible-node-labels.worker.capacity=100

yarn.scheduler.capacity.root.default.accessible-node-labels.coordinator.capacity=100

yarn.scheduler.capacity.root.default.accessible-node-labels.worker.capacity=100

2.刷新CapacityScheduler时,default cannot be found during refresh!

没有设置default队列

上述设置完成,使用前文的presto启动命令启动

bin/slider package --install --name PRESTO --package ../presto-yarn-package-1.6-SNAPSHOT-0.220.zip

bin/slider create presto1 --template appConfig-default.json --resources resources-default.json

诸将莫慌,粮草已到!

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值