edit-icon download-icon

YARN authorization

Last Updated: Mar 23, 2018

YARN authorization can be divided to service-level authorization and queue-level authorization based on the authorization entity.

1. Service-level authorization

For more information, see Hadoop official documentation

  • Control cluster service access by specific users, such as submitting jobs
  • Configures hadoop-policy.xml
  • Service level permission validation has a higher priority than other permission validation procedures (such as HDFS permission verification and YARN job submission control)


Generally, if HDFS permission verification and YARN job submission control have been set up, you may choose not to set the service level permission control. You can perform the relevant configurations as needed.

2. Queue-level authorization

YARN supports permission control over resources through queues, and it provides two queue scheduling methods, namely Capacity Scheduler and Fair Scheduler.

We will take the Capacity Scheduler as an example here.

2.1 Add configuration

A queue also has a two-level authorization: the authorization for job submission (submitting a job to the queue) and the authorization for queue management.


a) The ACL control object for a queue is user/group. The users and groups can be set at the same time (separated by spaces) when you set up the relevant parameters. You can use a comma to separate different users and groups. Using only one space means that no one has the permission.

b) ACL inheritance for a queue: If a user/group can submit an application to a queue, then this user/group can submit applications to all sub-queues of this queue. Likewise, the ACL that manages queues can also be inherited. Therefore, if you want to prevent a user/group from submitting jobs to a queue, you must set the ACL for this queue and all its parent queues to restrict the job-submission permission of this user/group.

  • yarn.acl.enable

    ACL switch, set to true

  • yarn.admin.acl

    YARN administrator setting, which enables/disables executing yarn rmadmin, yarn kill, and other commands. This value must be configured, otherwise, the subsequent queue-based ACL administrator settings cannot take effect.

    As mentioned in the preceding note, you can set up user/group when setting up the values:

    1. user1,user2 group1,group2 #users and groups are separated by a space
    2. group1,group2 #In case there are only groups, a leading space is required.

    In an EMR cluster, you must configure the ACL permission for has as admin.

  • yarn.scheduler.capacity.${queue-name}.acl_submit_applications

    Set user/group that can submit jobs to this queue

    where ${queue-name} is the queue name. Multi-level queues are supported. Note that ACL is inherited in multi-level queues. For example:

    1. #queue-name=root
    2. <property>
    3. <name>yarn.scheduler.capacity.root.acl_submit_applications</name>
    4. <value> </value> # Space means no one can submit jobs to the root queue
    5. </property>
    6. #queue-name=root.testqueue
    7. <property>
    8. <name>yarn.scheduler.capacity.root.testqueue.acl_submit_applications</name>
    9. <value>test testgrp</value> #testqueue only allows the test user and testgrp group to submit jobs
    10. </property>
  • yarn.scheduler.capacity.${queue-name}.acl_administer_queue

    Set some user/group to manage the queue, such as killing a job in the queue.

    Multi-level queue-names are supported. Note that ACL is inherited in multi-level queues.

    1. #queue-name=root
    2. <property>
    3. <name>yarn.scheduler.capacity.root.acl_administer_queue</name>
    4. <value> </value>
    5. </property>
    6. #queue-name=root.testqueue
    7. <property>
    8. <name>yarn.scheduler.capacity.root.testqueue.acl_administer_queue</name>
    9. <value>test testgrp</value>
    10. </property>
2.2. Restart the YARN service

The Kerberos secure cluster has enabled ACL by default. You can configure the relevant ACL permissions for queues as needed.

For a non-Kerberos secure cluster, enable ACL and configure the permission control for queues in accordance with the preceding instructions, and then restart the YARN service.

2.3 Configuration example


  1. <property>
  2. <name>yarn.acl.enable</name>
  3. <value>true</value>
  4. </property>
  5. <property>
  6. <name>yarn.admin.acl</name>
  7. <value>has</value>
  8. </property>


Default queue: disables the default queue and do not allow any user to submit jobs or manage the queue.

Q1 queue: only allows the test user to submit jobs and manage the queue (such as killing the jobs).

Q2 queue: only allows the foo user to submit jobs and manage the queue.

  1. <configuration>
  2. <property>
  3. <name>yarn.scheduler.capacity.maximum-applications</name>
  4. <value>10000</value>
  5. <description>Maximum number of applications that can be pending and running.</description>
  6. </property>
  7. <property>
  8. <name>yarn.scheduler.capacity.maximum-am-resource-percent</name>
  9. <value>0.25</value>
  10. <description>Maximum percent of resources in the cluster which can be used to run application masters i.e.
  11. controls number of concurrent running applications.
  12. </description>
  13. </property>
  14. <property>
  15. <name>yarn.scheduler.capacity.resource-calculator</name>
  16. <value>org.apache.hadoop.yarn.util.resource.DefaultResourceCalculator</value>
  17. </property>
  18. <property>
  19. <name>yarn.scheduler.capacity.root.queues</name>
  20. <value>default,q1,q2</value>
  21. <!-- 3 queues-->
  22. <description>The queues at the this level (root is the root queue).</description>
  23. </property>
  24. <property>
  25. <name>yarn.scheduler.capacity.root.default.capacity</name>
  26. <value>0</value>
  27. <description>Default queue target capacity.</description>
  28. </property>
  29. <property>
  30. <name>yarn.scheduler.capacity.root.default.user-limit-factor</name>
  31. <value>1</value>
  32. <description>Default queue user limit a percentage from 0.0 to 1.0.</description>
  33. </property>
  34. <property>
  35. <name>yarn.scheduler.capacity.root.default.maximum-capacity</name>
  36. <value>100</value>
  37. <description>The maximum capacity of the default queue.</description>
  38. </property>
  39. <property>
  40. <name>yarn.scheduler.capacity.root.default.state</name>
  41. <value>STOPPED</value>
  42. <!-- Status of the default queue is set as STOPPED-->
  43. <description>The state of the default queue. State can be one of RUNNING or STOPPED.</description>
  44. </property>
  45. <property>
  46. <name>yarn.scheduler.capacity.root.default.acl_submit_applications</name>
  47. <value> </value>
  48. <!-- The default queue does not allow job submission-->
  49. <description>The ACL of who can submit jobs to the default queue.</description>
  50. </property>
  51. <property>
  52. <name>yarn.scheduler.capacity.root.default.acl_administer_queue</name>
  53. <value> </value>
  54. <!-- Prevent users/groups to manage the default queue-->
  55. <description>The ACL of who can administer jobs on the default queue.</description>
  56. </property>
  57. <property>
  58. <name>yarn.scheduler.capacity.node-locality-delay</name>
  59. <value>40</value>
  60. </property>
  61. <property>
  62. <name>yarn.scheduler.capacity.queue-mappings</name>
  63. <value>u:test:q1,u:foo:q2</value>
  64. <!-- Queue mapping, automatically maps the test user to Q1 queue-->
  65. <description>A list of mappings that will be used to assign jobs to queues. The syntax for this list is
  66. [u|g]:[name]:[queue_name][,next mapping]* Typically this list will be used to map users to queues,for
  67. example, u:%user:%user maps all users to queues with the same name as the user.
  68. </description>
  69. </property>
  70. <property>
  71. <name>yarn.scheduler.capacity.queue-mappings-override.enable</name>
  72. <value>true</value>
  73. <!-- Whether or not allow the above queue-mapping to overwrite the queue parameters set up by the client-->
  74. <description>If a queue mapping is present, will it override the value specified by the user? This can be used
  75. by administrators to place jobs in queues that are different than the one specified by the user. The default
  76. is false.
  77. </description>
  78. </property>
  79. <property>
  80. <name>yarn.scheduler.capacity.root.acl_submit_applications</name>
  81. <value> </value>
  82. <!-- ACL inheritance, the parent queue must have the admin permissions-->
  83. <description>
  84. The ACL of who can submit jobs to the root queue.
  85. </description>
  86. </property>
  87. <property>
  88. <name>yarn.scheduler.capacity.root.q1.acl_submit_applications</name>
  89. <value>test</value>
  90. <!-- q1 only allows the test user to submit jobs-->
  91. </property>
  92. <property>
  93. <name>yarn.scheduler.capacity.root.q2.acl_submit_applications</name>
  94. <value>foo</value>
  95. <!-- q2 allows the foo user to submit jobs-->
  96. </property>
  97. <property>
  98. <name>yarn.scheduler.capacity.root.q1.maximum-capacity</name>
  99. <value>100</value>
  100. </property>
  101. <property>
  102. <name>yarn.scheduler.capacity.root.q2.maximum-capacity</name>
  103. <value>100</value>
  104. </property>
  105. <property>
  106. <name>yarn.scheduler.capacity.root.q1.capacity</name>
  107. <value>50</value>
  108. </property>
  109. <property>
  110. <name>yarn.scheduler.capacity.root.q2.capacity</name>
  111. <value>50</value>
  112. </property>
  113. <property>
  114. <name>yarn.scheduler.capacity.root.acl_administer_queue</name>
  115. <value> </value>
  116. <!-- ACL inheritance, the parent queue must have the admin permissions-->
  117. </property>
  118. <property>
  119. <name>yarn.scheduler.capacity.root.q1.acl_administer_queue</name>
  120. <value>test</value>
  121. <!-- q1 only allow the test user to manage the queue, such as killing the jobs-->
  122. </property>
  123. <property>
  124. <name>yarn.scheduler.capacity.root.q2.acl_administer_queue</name>
  125. <value>foo</value>
  126. <!-- q2 only allow the foo user to manage the queue, such as killing the jobs-->
  127. </property>
  128. <property>
  129. <name>yarn.scheduler.capacity.root.q1.state</name>
  130. <value>RUNNING</value>
  131. </property>
  132. <property>
  133. <name>yarn.scheduler.capacity.root.q2.state</name>
  134. <value>RUNNING</value>
  135. </property>
  136. </configuration>
Thank you! We've received your feedback.