以下基于 hadoop版本 hadoop-2.8.4

给各个节点打标签

yarn rmadmin -addToClusterNodeLabels fastcpu,normal
# 是否独占默认是true,不独占其他队列就可以normal标签资源
yarn rmadmin -addToClusterNodeLabels "fastcpu,normal(exclusive=false)"
yarn rmadmin -replaceLabelsOnNode "container-192-168-200-140,fastcpu"
# container-192-168-200-141不打标签,也可以不执行此命令
yarn rmadmin -replaceLabelsOnNode "container-192-168-200-141, "
yarn rmadmin -replaceLabelsOnNode "container-192-168-200-142,normal"
1.spark任务可以通过spark-submit方式指定参数spark.yarn.am.nodeLabelExpression和spark.yarn.executor.nodeLabelExpression来实现,使任务提交到特定的分区。
./bin/spark-submit --class org.apache.spark.examples.SparkPi
--master yarn --deploy-mode cluster --driver-memory 3g --executor-memory 2g
--conf spark.yarn.am.nodeLabelExpression=fastcpu
--conf spark.yarn.executor.nodeLabelExpression=fastcpu jars/spark-examples.jar 10
2.hadoop distribute shell / hadoop job 也可以。
hadoop jar ./share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.8.4.jar -shell_command "sleep 100000" -jar ./share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.8.4.jar  -num_containers 5 -queue etl-ywpt -node_label_expression fastcpu
mr example wordcount:
hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.8.4.jar wordcount -D mapreduce.job.node-label-expression="fastcpu" -D mapreduce.job.queuename="etl-ywpt" /hadoop-hadoop-namenode-container-192-168-200-140.log /output
3.另外还可以通过yarn代码的方式提交;hive可以指定如下参数 提交指定队列及label。
set mapreduce.job.node-label-expression=fastcpu;
set mapreduce.job.queuename=etl-bi;

yarn web ui

yarn 8088调度页面

node 的 label 页面


容量调度才能使用label便签,公平调度暂时不支持标签。
配置文件 capacity-scheduler.xml
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<configuration>
<property>
<name>yarn.scheduler.capacity.maximum-applications</name>
<value>10000</value>
<description>
Maximum number of applications that can be pending and running.
</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.queues</name>
<value>default,etl-ywpt,etl-bi,etl-ly,etl-test,hue,bi</value>
</property>
<!--
<property>
<name>yarn.scheduler.capacity.root.acl_submit_applications</name>
<value> </value>
</property>
<property>
<name>yarn.scheduler.capacity.root.acl_administer_queue</name>
<value>hadoop </value>
</property>
-->
<property>
<name>yarn.scheduler.capacity.maximum-am-resource-percent</name>
<value>0.2</value>
<description>
Maximum percent of resources in the cluster which can be used to run
application masters i.e. controls number of concurrent running
applications.
</description>
</property> <property>
<name>yarn.scheduler.capacity.resource-calculator</name>
<value>org.apache.hadoop.yarn.util.resource.DominantResourceCalculator</value>
</property> <!--
<property>
<name>yarn.scheduler.capacity.resource-calculator</name>
<value>org.apache.hadoop.yarn.util.resource.DefaultResourceCalculator</value>
<description>
The ResourceCalculator implementation to be used to compare
Resources in the scheduler.
The default i.e. DefaultResourceCalculator only uses Memory while
DominantResourceCalculator uses dominant-resource to compare
multi-dimensional resources such as Memory, CPU etc.
</description>
</property>
--> <!-- label两种模式 normal/fastcpu --> <!-- root队列可提交的标签 -->
<property>
<name>yarn.scheduler.capacity.root.capacity</name>
<value>100</value>
</property>
<property>
<name>yarn.scheduler.capacity.root.maximum-capacity</name>
<value>100</value>
</property>
<property>
<name>yarn.scheduler.capacity.root.accessible-node-labels</name>
<value>*</value>
</property>
<property>
<name>yarn.scheduler.capacity.root.accessible-node-labels.normal.capacity</name>
<value>100</value>
<description>root队列对normal标签节点可用的百分比</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.accessible-node-labels.fastcpu.capacity</name>
<value>100</value>
<description>root队列对fastcpu标签节点可用的百分比</description>
</property> <!-- default队列 --> <property>
<name>yarn.scheduler.capacity.root.default.accessible-node-labels</name>
<value>normal</value>
<description>default队列应用可用的节点标签</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.default.default-node-label-expression</name>
<value>normal</value>
<description>default队列应用默认节点标签</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.default.accessible-node-labels.normal.capacity</name>
<value>10</value>
<description>default队列对normal标签节点可用的百分比</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.default.accessible-node-labels.normal.maximum-capacity</name>
<value>50</value>
</property> <property>
<name>yarn.scheduler.capacity.root.default.capacity</name>
<value>10</value>
<description>Default queue target capacity.</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.default.maximum-capacity</name>
<value>20</value>
<description>
The maximum capacity of the default queue.
</description>
</property> <!-- etl-ywpt队列 --> <property>
<name>yarn.scheduler.capacity.root.etl-ywpt.accessible-node-labels</name>
<value>*</value>
<description>etl-ywpt队列应用可用的节点标签</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-ywpt.default-node-label-expression</name>
<value>normal</value>
<description>etl-ywpt队列应用默认节点标签</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-ywpt.accessible-node-labels.normal.capacity</name>
<value>10</value>
<description>etl-ywpt队列对fastcpu标签节点可用的百分比</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-ywpt.accessible-node-labels.normal.maximum-capacity</name>
<value>20</value>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-ywpt.accessible-node-labels.fastcpu.capacity</name>
<value>50</value>
<description>etl-ywpt队列对fastcpu标签节点可用的百分比</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-ywpt.accessible-node-labels.fastcpu.maximum-capacity</name>
<value>60</value>
</property> <property>
<name>yarn.scheduler.capacity.root.etl-ywpt.capacity</name>
<value>5</value>
</property> <property>
<name>yarn.scheduler.capacity.root.etl-ywpt.maximum-capacity</name>
<value>30</value>
</property> <!-- etl-bi队列 --> <property>
<name>yarn.scheduler.capacity.root.etl-bi.accessible-node-labels</name>
<value>fastcpu</value>
<description>etl-bi队列应用可用的节点标签</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-bi.default-node-label-expression</name>
<value>fastcpu</value>
<description>etl-bi队列应用默认节点标签</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-bi.accessible-node-labels.fastcpu.capacity</name>
<value>50</value>
<description>etl-bi队列对fastcpu标签节点可用的百分比</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-bi.accessible-node-labels.fastcpu.maximum-capacity</name>
<value>100</value>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-bi.capacity</name>
<value>3</value>
</property> <property>
<name>yarn.scheduler.capacity.root.etl-bi.maximum-capacity</name>
<value>20</value>
</property> <!-- etl-ly队列 -->
<property>
<name>yarn.scheduler.capacity.root.etl-ly.accessible-node-labels</name>
<value>normal</value>
<description>etl-ly队列应用可用的节点标签</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-ly.default-node-label-expression</name>
<value>normal</value>
<description>etl-ly队列应用默认节点标签</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-ly.accessible-node-labels.normal.capacity</name>
<value>20</value>
<description>default队列对normal标签节点可用的百分比</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-ly.accessible-node-labels.fastcpu.maximum-capacity</name>
<value>100</value>
</property> <property>
<name>yarn.scheduler.capacity.root.etl-ly.capacity</name>
<value>52</value>
</property> <property>
<name>yarn.scheduler.capacity.root.etl-ly.maximum-capacity</name>
<value>55</value>
</property> <!-- etl-test队列 -->
<property>
<name>yarn.scheduler.capacity.root.etl-test.accessible-node-labels</name>
<value>normal</value>
<description>etl-test队列应用可用的节点标签</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-test.default-node-label-expression</name>
<value>normal</value>
<description>etl-test队列应用默认节点标签</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-test.accessible-node-labels.normal.capacity</name>
<value>10</value>
<description>etl-test队列对normal标签节点可用的百分比</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-test.accessible-node-labels.normal.maximum-capacity</name>
<value>100</value>
</property>
<property>
<name>yarn.scheduler.capacity.root.etl-test.capacity</name>
<value>10</value>
</property> <property>
<name>yarn.scheduler.capacity.root.etl-test.maximum-capacity</name>
<value>50</value>
</property> <!-- hue队列 -->
<property>
<name>yarn.scheduler.capacity.root.hue.accessible-node-labels</name>
<value>normal</value>
<description>hue队列应用可用的节点标签</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.hue.default-node-label-expression</name>
<value>normal</value>
<description>hue队列应用默认节点标签</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.hue.accessible-node-labels.normal.capacity</name>
<value>10</value>
<description>hue队列对normal标签节点可用的百分比</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.hue.accessible-node-labels.normal.maximum-capacity</name>
<value>100</value>
</property>
<property>
<name>yarn.scheduler.capacity.root.hue.capacity</name>
<value>10</value>
</property> <property>
<name>yarn.scheduler.capacity.root.hue.maximum-capacity</name>
<value>50</value>
</property> <!-- bi队列 -->
<property>
<name>yarn.scheduler.capacity.root.bi.accessible-node-labels</name>
<value>normal</value>
<description>bi队列应用可用的节点标签</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.bi.default-node-label-expression</name>
<value>normal</value>
<description>bi队列应用默认节点标签</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.bi.accessible-node-labels.normal.capacity</name>
<value>40</value>
<description>bi队列对fastcpu标签节点可用的百分比</description>
</property>
<property>
<name>yarn.scheduler.capacity.root.bi.accessible-node-labels.normal.maximum-capacity</name>
<value>100</value>
</property>
<property>
<name>yarn.scheduler.capacity.root.bi.capacity</name>
<value>10</value>
</property> <property>
<name>yarn.scheduler.capacity.root.bi.maximum-capacity</name>
<value>20</value>
</property> </configuration>

YARN label 特性 & 指定队列及label提交任务的更多相关文章

  1. django-celery 创建多个broker队列 异步执行任务时指定队列

    一.这里不再详细述说 django 框架中如何使用celery, 重点放在如何实现创建多个队列, 并指定队列存放异步任务 笔者使用   django-celery==3.2.2 模块, 配置项及配置参 ...

  2. 洛谷 P1160 队列安排 Label:链表 数据结构

    题目描述 一个学校里老师要将班上N个同学排成一列,同学被编号为1-N,他采取如下的方法: 1.先将1号同学安排进队列,这时队列中只有他一个人: 2.2-N号同学依次入列,编号为i的同学入列方式为:老师 ...

  3. 转: 【Java并发编程】之二十一:并发新特性—阻塞队列和阻塞栈(含代码)

    转载请注明出处:http://blog.csdn.net/ns_code/article/details/17511147 阻塞队列 阻塞队列是Java5并发新特性中的内容,阻塞队列的接口是Java. ...

  4. db2 v9.7 新特性cur_commit 能够实现未提交读新特性cur_commit 能够实现未提交读

    db2 get db cfg|find "CUR_COMMIT" 当前已落实                                   (CUR_COMMIT) = ON ...

  5. 【Java并发编程】:并发新特性—塞队列和阻塞栈

    阻塞队列 阻塞队列是Java5并发新特性中的内容,阻塞队列的接口是Java.util.concurrent.BlockingQueue,它有多个实现类:ArrayBlockingQueue.Delay ...

  6. 使用FROM确认按钮(键盘13号键)提交特性并使用ajax.POST提交.

    如果又想使用FROM确认按钮(键盘13号键)提交特性  还能继续用AJAX.POST提交.就需要使用return false 来阻止FROM默认提交 代码如下: HTML页面 这里最关键就是用了ret ...

  7. label 标签的用法,点label选中单选、复选框或文本框

    <label>拥有的权限</label> <label class="checkbox" id="privilege_id" st ...

  8. Java高级特性—消息队列

    1)什么是jms JMS即Java消息服务(Java Message Service)应用程序接口是一个Java平台中关于面向消息中间件(MOM)的API. 它便于消息系统中的Java应用程序进行消息 ...

  9. Qt添加窗口背景图片、Label图片显示、、Label文字显示

    一.添加窗口背景图片 重写MainWindow绘制事件 void MainWindow::paintEvent(QPaintEvent *event) { QPainter painter(this) ...

随机推荐

  1. InfluxDB HTTP API reference

    InfluxDB HTTP API reference API地址:https://docs.influxdata.com/influxdb/v1.6/tools/api/ The InfluxDB ...

  2. 禁用触发器的N种方法

    一.禁用和启用单个触发器 禁用: ALTER TABLE trig_example DISABLE TRIGGER trig1 GO   恢复: ALTER TABLE trig_example EN ...

  3. CentOS 7.4 初次手记:第一章 Linux守护进程(daemon)

    第一节 init & sysvinit 6 I sysvinit 运行顺序... 6 II Sysvinit和系统关闭... 7 III Sysvinit 的小结... 7 IV 运行级别.. ...

  4. 从错误0x80070522,谈强制完整性控制(MIC)。

    在Windows 7碰到一个奇怪的问题,DE二个盘,NTFS的权限(属性--安全页)一模一样,没有任何区别,但在E盘根目录可以创建文件或文件夹,而在D盘根目录下报错:0x80070522,如果使用应用 ...

  5. [转][html]radio 获取选中状态

    方法一: if ($("#checkbox-id").get(0).checked) { // do something } 方法二: if($('#checkbox-id').i ...

  6. 3d图像坐标轴及css3属性的讲解

    3d立体坐标轴 如有不知道各种插件的怎么办? 网上查,百度 1.css选择器: 1.id 2.class 3.标签 4.子代 5.后代 6.交集 7.并级 8.通配符 9.结构 10.伪类 11.属性 ...

  7. Windows和pthread中提供的自旋锁

    Windows和POSIX中都提供了自旋锁,我们也可以通过C++11的atomic来实现自旋锁.那么两者性能上面是什么关系?先引入实现代码: #ifndef __spinlock_h__ #defin ...

  8. maven工程强制更新 ,下载源码操作

    看图,在window->preferences->maven , 勾选图中的选项就可以下载源码包了,

  9. Hbase设置多个hmaster

    Hbase设置多个hmaster https://www.cnblogs.com/prayer21/p/4866673.html

  10. 用dlopen,dlsym加载动态链接库.so中函数

    代码如下 static void *findSymbol(const char *path, const char *symbol) { void *handle = dlopen(path, RTL ...