yarn label scheduler

本文详细介绍了如何在YARN中配置节点标签和资源调度策略,包括修改yarn-site.xml和capacity-scheduler.xml文件,添加和分配节点标签,以及调整队列参数来实现更精细的资源管理和任务调度。

1、在yarn-site.xml中添加以下属性

   <property>
      <name>yarn.node-labels.enabled</name>
      <value>true</value>
   </property>
   <property>
      <name>yarn.node-labels.fs-store.root-dir</name>
      <value>/yarn/node-label</value>
   </property>
   <property>
      <name>yarn.node-labels.manager-class</name>
      <value>org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager</value>
   </property>

2、在capacity-scheduler.xml添加以下属性

  <property>
    <name>yarn.scheduler.capacity.root.queues</name>
    <value>default,other</value>
    <description>
      The queues at the this level (root is the root queue).
    </description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.maximum-applications</name>
    <value>20000</value>
    <description>
      Maximum number of applications that can be pending and running.
    </description>
  </property>
  <property>
    <name>yarn.scheduler.capacity.root.default.maximum-applications</name>
    <value>10000</value>
  </property>
  <property>
    <name>yarn.scheduler.capacity.root.other.maximum-applications</name>
    <value>10000</value>
  </property>

  <property>
    <name>yarn.scheduler.capacity.root.default.capacity</name>
    <value>100</value>
    <description>Default queue target capacity.</description>
  </property>
  <property>
    <name>yarn.scheduler.capacity.root.other.capacity</name>
    <value>0</value>
  </property>

  <property>
    <name>yarn.scheduler.capacity.root.default.maximum-capacity</name>
    <value>100</value>
    <description>
      The maximum capacity of the default queue.
    </description>
  </property>

  <property>
    <name>yarn.scheduler.capacity.root.other.accessible-node-labels</name>
    <value>high_disk</value>
  </property>

  <property>
    <name>yarn.scheduler.capacity.root.accessible-node-labels.high_disk.capacity</name>
    <value>100</value>
  </property>
  <property>
    <name>yarn.scheduler.capacity.root.other.accessible-node-labels.high_disk.capacity</name>
    <value>100</value>
  </property>


  <property>
    <name>yarn.scheduler.capacity.root.other.default-node-label-expression</name>
    <value>high_disk</value>
  </property>

3、添加标签

yarn rmadmin -addToClusterNodeLabels high_disk  #多个标签用逗号分隔

4、给节点添加标签

yarn rmadmin -replaceLabelsOnNode 192.168.1.101,high_disk  #ip后可以跟端口,若没有端口,则该节点上所有nodemanager都是一个标签,添加完并刷新后在web ui 中可以看到每个节点的node labels

5、刷新队列配置

yarn rmadmin -refreshQueues

<think>Hmm, the user is asking how to refresh YARN queue configuration. Let me break this down. First, I recall that YARN queue configuration is managed through the capacity-scheduler.xml file for Capacity Scheduler, or fair-scheduler.xml for Fair Scheduler. The key point is that changes to these files don't take effect immediately - they need to be refreshed. Looking at the references provided, reference [2] specifically mentions editing capacity-scheduler.xml for queue label policies, and reference [3] discusses FairScheduler queue properties. This aligns with what I know about YARN configuration. The user seems to be a Hadoop administrator or developer working with YARN queues. Their question is very specific and technical, suggesting they're probably in the middle of some cluster configuration work. The tone is straightforward - they just want the quickest way to apply their config changes. The main methods I should cover are: 1) The yarn rmadmin -refreshQueues command (most common method) 2) Alternative methods like HDFS reload and service restart for completeness 3) Special considerations for Fair Scheduler since it has different behavior I should emphasize that for Capacity Scheduler, refreshQueues is instantaneous and preferred, while Fair Scheduler requires additional steps. The security note about needing admin privileges is important too - they might run into permission issues otherwise. The references support this approach: [1] gives context about YARN architecture, [2] shows queue config examples, and [3] confirms FairScheduler behaviors. I'll structure the answer to give the simplest solution first, then alternatives, then edge cases.</think>要刷新 YARN 队列配置(如修改 `capacity-scheduler.xml` 或 `fair-scheduler.xml` 后),需执行以下步骤: --- ### 🔧 方法 1:使用 YARN 命令(推荐) 1. **刷新队列配置**(需 YARN 管理员权限): ```bash yarn rmadmin -refreshQueues ``` - ✅ **效果**:即时生效,无需重启服务。 - ⚠️ **要求**:用户需具有 `yarn.admin.acl` 权限(通常在 `yarn-site.xml` 中配置)[^1][^2]。 2. **验证刷新结果**: ```bash yarn queue -status <队列名> # 查看队列状态 yarn scheduler -conf # 检查当前加载的配置 ``` --- ### 🔄 方法 2:通过 HDFS 重载(部分场景) 若队列配置与 HDFS 存储路径绑定(如 Fair Scheduler 的 `allocations file`): 1. 修改 XML 配置文件后,将文件上传至 HDFS: ```bash hdfs dfs -put fair-scheduler.xml /yarn/scheduler/ ``` 2. 触发配置重载: ```bash yarn rmadmin -refreshQueues ``` --- ### ⚠️ 注意事项 1. **调度器类型差异**: - **Capacity Scheduler**:`refreshQueues` 会**立即应用**所有队列配置变更(如资源比例、ACL 等)[^2]。 - **Fair Scheduler**:仅动态加载队列权重、ACL 等部分配置,**队列结构变更**需重启 ResourceManager[^3]。 2. **权限问题**: - 若命令报错 `User cannot run ADMIN commands`,需在 `yarn-site.xml` 添加: ```xml <property> <name>yarn.admin.acl</name> <value>你的用户名</value> </property> ``` 3. **服务重启(最后手段)**: ```bash systemctl restart hadoop-yarn-resourcemanager # 重启 ResourceManager ``` --- ### 📝 操作示例 ```bash # 修改 capacity-scheduler.xml 后刷新 $ sudo -u yarn yarn rmadmin -refreshQueues 2024-07-18 12:30:45 INFO refresh: Refreshing queues... Success ``` > **关键提示**:生产环境优先使用 `refreshQueues` 命令,避免服务中断[^1][^3]。 --- ### ❓相关问题 1. YARN 队列配置更新后任务资源未生效,如何排查? 2. Capacity Scheduler 与 Fair Scheduler 的动态刷新支持有哪些差异? 3. 如何安全地修改生产集群的 YARN 队列 ACL 权限? [^1]: Yarn 工作机制与调度器配置 [^2]: Capacity Scheduler 队列标签策略刷新 [^3]: FairScheduler 队列属性动态加载限制
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值