- yarn幾種調度簡介
Yarn 調度器Scheduler詳解
- fair scheduler詳解
fair scheduler每一項配置詳解:Hadoop YARN配置參數剖析(4)—Fair Scheduler相關參數
官網關於fair scheduler配置詳解:Hadoop MapReduce Next Generation - Fair Scheduler 在cloudera manager中,默認啓用的就是fair scheduler,搶佔機制也會幫你開啓,只須要在配置項" Fair Scheduler XML 高級配置代碼段(安全閥)"修改你的fair scheduler配置文件便可。能夠配置成以下內容:
<allocations>
<queue name="root">
<minResources>5120mb,5 vcores</minResources>
<maxResources>32768mb,32 vcores</maxResources>
<maxRunningApps>20</maxRunningApps>
<minSharePreemptionTimeout>30</minSharePreemptionTimeout>
<fairSharePreemptionTimeout>30</fairSharePreemptionTimeout>
<weight>1.0</weight>
<aclSubmitApps>*</aclSubmitApps>
<aclAdministerApps>root,bigdata</aclAdministerApps>
<fairSharePreemptionTimeout>6000</fairSharePreemptionTimeout>
<queue name="main-queue">
<minResources>20480 mb, 16 vcores</minResources>
<maxResources>32768 mb, 32 vcores</maxResources>
</queue>
<queue name="bigdata">
<minResources>5120 mb,5 vcores</minResources>
<maxResources>20480 mb,24 vcores</maxResources>
</queue>
<queue name="anonymous">
<minResources>5120 mb,5 vcores</minResources>
<maxResources>20480 mb,24 vcores</maxResources>
</queue>
</queue>
</allocations>
- 相關知識點
- 資源搶佔(Preemption)
當一個job提交到一個繁忙集羣中的空隊列時,job並不會立刻執行,而是阻塞直到正在運行的job釋放系統資源。爲了使提交job的執行時間更具預測性(能夠設置等待的超時時間),Fair調度器支持搶佔。搶佔就是容許調度器殺掉佔用超過其應占份額資源隊列的containers,這些containers資源即可被分配到應該享有這些份額資源的隊列中。須要注意搶佔會下降集羣的執行效率,由於被終止的containers須要被從新執行。能夠經過設置一個全局的參數yarn.scheduler.fair.preemption=true來啓用搶佔功能。此外,還有兩個參數用來控制搶佔的過時時間(這兩個參數默認沒有配置,須要至少配置一個來容許搶佔Container): minimum share preemption timeout,fair share preemption timeout
若是隊列在minimum share preemption timeout指定的時間內未得到最小的資源保障,調度器就會搶佔containers。咱們能夠經過配置文件中的頂級元素<defaultMinSharePreemptionTimeout>爲全部隊列配置這個超時時間;咱們還能夠在<queue>元素內配置<minSharePreemptionTimeout>元素來爲某個隊列指定超時時間。
與之相似,若是隊列在fair share preemption timeout指定時間內未得到平等的資源的一半(這個比例能夠配置),調度器則會進行搶佔containers。這個超時時間能夠經過頂級元素<defaultFairSharePreemptionTimeout>和元素級元素<fairSharePreemptionTimeout>分別配置全部隊列和某個隊列的超時時間。上面提到的比例能夠經過<defaultFairSharePreemptionThreshold>(配置全部隊列)和<fairSharePreemptionThreshold>(配置某個隊列)進行配置,默認是0.5。
- 設置hive的mapreduce任務提交的隊列
在cloudera manager中,設置hive的配置項" hive-site.xml 的 Hive 服務高級配置代碼段(安全閥)",配置以下屬性:
<property>
<name>mapred.job.queue.name</name>
<value>bigdata</value>
</property>