1. 程式人生 > >hadoop 高階 | hadoop佇列管理與資源隔離

hadoop 高階 | hadoop佇列管理與資源隔離

  • 功能點
  • 配置
    • 配置ResouceManager使用CapacityScheduler
    • 設定佇列
    • 佇列屬性
    • 佇列屬性配置
    • 修改配置檔案
    • 設定任務的優先順序
  • 其他元件使用hadoop佇列
    • Hive
  • 補充
  • 參考

功能點

  • Hierarchical Queues(佇列可分層)
  • Capacity Guarantees
  • Security(安全性)
  • Elasticity
  • Multi-tenancy
  • Operability
  • Resource-based Scheduling
  • Queue Mapping based on User or Group: 可以基於使用者或使用者組分配佇列;
  • Priority Scheduling(優先順序):

配置

配置ResouceManager使用CapacityScheduler

修改conf/yarn-site.xml檔案

屬性
yarn.resourcemanager.scheduler.class org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler

設定佇列

修改capacity-scheduler.xml配置檔案.

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

其中預設有default佇列,現新增queues11佇列。

佇列屬性

  • yarn.scheduler.capacity.root.default.capacity:一個百分比的值,表示佔用整個叢集的百分之多少比例的資源,這個queue-path下所有的capacity之和是100
  • yarn.scheduler.capacity.root.default.user-limit-factor:每個使用者的低保百分比,比如設定為1,則表示無論有多少使用者在跑任務,每個使用者佔用資源最低不會少於1%的資源
  • yarn.scheduler.capacity.root.default.maximum-capacity:彈性設定,最大時佔用多少比例資源
  • yarn.scheduler.capacity.root.default.state:佇列狀態,可以是RUNNING或STOPPED
  • yarn.scheduler.capacity.root.default.acl_submit_applications:哪些使用者或使用者組可以提交任務
  • yarn.scheduler.capacity.root.default.acl_administer_queue:哪些使用者或使用者組可以管理佇列

佇列屬性配置

  • 資源分配比例: default(40%), batch(60%)
  • 佇列管理許可權: default與batch佇列管理員為admin
  • 佇列提交任務: detault佇列為所有使用者均可提交任務,batch佇列只有devops, admin使用者可以提交任務。
  • default佇列裡單個任務最大佔用資源比例為60%

修改配置檔案

  <!-- default queue -->
  <property>
    <name>yarn.scheduler.capacity.root.default.capacity</name>
    <value>40</value>
    <description>Default queue target capacity.</description>
  </property>
  <property>
    <name>yarn.scheduler.capacity.root.default.user-limit-factor</name>
    <value>1</value>
    <description>Default queue user limit a percentage from 0.0 to 1.0.</description>
  </property>
  <property>
    <name>yarn.scheduler.capacity.root.default.maximum-capacity</name>
    <value>60</value>
    <description>The maximum capacity of the default queue.</description>
  </property>
  <property>
    <name>yarn.scheduler.capacity.root.default.state</name>
    <value>RUNNING</value>
    <description>The state of the default queue. State can be one of RUNNING or STOPPED.</description>
  </property>
  <property>
    <name>yarn.scheduler.capacity.root.default.acl_submit_applications</name>
    <value>*</value>
    <description>The ACL of who can submit jobs to the default queue.</description>
  </property>
  <property>
    <name>yarn.scheduler.capacity.root.default.acl_administer_queue</name>
    <value>admin</value>
    <description>The ACL of who can administer jobs on the default queue.</description>
  </property>


  <!-- batch queue -->
  <property>
    <name>yarn.scheduler.capacity.root.batch.capacity</name>
    <value>60</value>
    <description>batch queue target capacity.</description>
  </property>
  <property>
    <name>yarn.scheduler.capacity.root.batch.user-limit-factor</name>
    <value>1</value>
    <description>batch queue user limit a percentage from 0.0 to 1.0.</description>
  </property>
  <property>
    <name>yarn.scheduler.capacity.root.batch.maximum-capacity</name>
    <value>100</value>
    <description>The maximum capacity of the batch queue.</description>
  </property>
  <property>
    <name>yarn.scheduler.capacity.root.batch.state</name>
    <value>RUNNING</value>
    <description>The state of the queues11 queue. State can be one of RUNNING or STOPPED.</description>
  </property>
  <property>
    <name>yarn.scheduler.capacity.root.batch.acl_submit_applications</name>
    <value>admin,devops</value>
    <description>The ACL of who can submit jobs to the batch queue.</description>
  </property>
  <property>
    <name>yarn.scheduler.capacity.root.batch.acl_administer_queue</name>
    <value>admin</value>
    <description>The ACL of who can administer jobs on the batch queue.</description>
  </property>

設定任務的優先順序

其他元件使用hadoop佇列

Hive

SET mapreduce.job.queuename=batch;

補充

  • ACLs: DFS支援POSIXAccess Control Lists(ACL),也就是傳統的POSIX許可權控制。通過提供一種方式來設定特定使用者或使用者組指定為不同許可權的HDFS檔案ACL訪問控制,類似於Linux檔案系統許可權.

參考