hadoop - YARN 中公平调度程序的 ACL 不起作用

标签 hadoop mapreduce hadoop-yarn hadoop2

我在 fair-scheduler.xml 中用 ACL 配置了我的队列。 但是其他用户也可以在同一个队列中运行作业。 我是否需要根据我的队列在其他地方定义 ACL。 任何链接或帮助将不胜感激。谢谢

 <queue name="queue1">
            <minResources>10000mb,10vcores</minResources>
            <maxResources>30000mb,30vcores</maxResources>
            <maxRunningApps>10</maxRunningApps>
            <weight>2.0</weight>
            <schedulingMode>fair</schedulingMode>
            <aclAdministerApps>User1</aclAdministerApps>
            <aclSubmitApps>User1</aclSubmitApps>
    </queue> 

最佳答案

注意:这是关于容量调度器的。不确定公平调度程序 ACL 继承行为是否不同。

ACL 通过 yarn.scheduler.capacity.<queue-path>.acl_submit_applications 配置, 请参阅 Capacity Scheduler :

yarn.scheduler.capacity.root.<queue-path>.acl_submit_applications The ACL which controls who can submit applications to the given queue. If the given user/group has necessary ACLs on the given queue or one of the parent queues in the hierarchy they can submit applications. ACLs for this property are inherited from the parent queue if not specified.

请注意有关队列继承父队列 ACL 的位。由于通常所有队列都继承自根队列,并且根队列ACL保留为默认capacity-scheduler.xml作为* :

<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>

因此,通常所有队列都会为所有用户 (*) 获取 ACL,以便能够提交。当您配置队列时,您应该确保限制父队列以及您想要的队列。

更新

在查看 FS 队列代码后,我必须得出结论,行为是相同的。访问检查在 AllocationConfiguration.hasAccess() 中完成:

 public boolean hasAccess(String queueName, QueueACL acl,
      UserGroupInformation user) {
    int lastPeriodIndex = queueName.length();
    while (lastPeriodIndex != -1) {
      String queue = queueName.substring(0, lastPeriodIndex);
      if (getQueueAcl(queue, acl).isUserAllowed(user)) {
        return true;
      }

      lastPeriodIndex = queueName.lastIndexOf('.', lastPeriodIndex - 1);
    }

    return false;
  }

并不是说代码会遍历队列层次结构(通过在名称中的每个句点拆分广告)直到其中一个父队列授予访问权限。与容量调度程序行为完全一样。直到它到达根队列,此时这段代码才生效:

/**
   * Get the ACLs associated with this queue. If a given ACL is not explicitly
   * configured, include the default value for that ACL.  The default for the
   * root queue is everybody ("*") and the default for all other queues is
   * nobody ("")
   */
  public AccessControlList getQueueAcl(String queue, QueueACL operation) {
    Map<QueueACL, AccessControlList> queueAcls = this.queueAcls.get(queue);
    if (queueAcls != null) {
      AccessControlList operationAcl = queueAcls.get(operation);
      if (operationAcl != null) {
        return operationAcl;
      }
    }
    return (queue.equals("root")) ? EVERYBODY_ACL : NOBODY_ACL;
  }

还要注意队列是如何加载的,来自 AllocationFileLoaderService.reloadAllocations() :

// Load queue elements.  A root queue can either be included or omitted.  If
// it's included, all other queues must be inside it.
for (Element element : queueElements) {
  String parent = "root";
  ...
  loadQueue(parent, element, minQueueResources, maxQueueResources,
      queueMaxApps, userMaxApps, queueMaxAMShares, queueWeights,
      queuePolicies, minSharePreemptionTimeouts, queueAcls,
      configuredQueues);
}

/**
* Loads a queue from a queue element in the configuration file
*/
private void loadQueue(String parentName, Element element, ...) 
  throws AllocationConfigurationException {
String queueName = element.getAttribute("name");
if (parentName != null) {
  queueName = parentName + "." + queueName;
}    

注意队列名称实际上是如何与父队列和 "root" 连接在一起的是所有队列的隐式父级。因此,您的队列名称确实是 root.queue1 .

所以这意味着在 FS 调度器中,所有队列默认都允许每个人访问,因为它们都继承了 root队列默认访问。您需要显式覆盖 root在您的配置文件中排队 ACL。这与 CapacityScheduler 没有什么不同,但我认为获取默认表单配置的 CS 行为优于从代码获取默认值的 FS 行为。

我没有实际测试 FS 行为,但代码可能会在读取时执行。

关于hadoop - YARN 中公平调度程序的 ACL 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25846479/

相关文章:

spring - Hadoop Mapper 中的依赖注入(inject)

python - 如何让 Reducer 根据键类型发出

hadoop - AWS将配置单元SSH减少到datanode

hadoop - Pig 0.11.1 - 对时间范围内的组进行计数

java - 从本地复制文件

java - Spark 流输出未保存到 HDFS 文件

hadoop - 如何获取特定正在运行的Hadoop作业的作业ID

hadoop - 客户端无法通过 :[TOKEN, KERBEROS 进行身份验证]

java - 从 eclipse 提交 hadoop 作业时出现 ConnectException

api - 纱 API : Getting Yarn Aggregated Logs for application by API