Hadoop YARN配置參數(shù)剖析(5)—Capacity Scheduler相關(guān)參數(shù)
Capacity Scheduler是YARN中默認(rèn)的資源調(diào)度器。
想要了解Capacity Scheduler是什么,可閱讀我的這篇文章“Hadoop Capacity Scheduler分析”。
在Capacity Scheduler的配置文件中,隊列queueX的參數(shù)Y的配置名稱為yarn.scheduler.capacity.queueX.Y,為了簡單起見,我們記為Y,則每個隊列可以配置的參數(shù)如下:
1. 資源分配相關(guān)參數(shù)
(1) capacity:隊列的資源容量(百分比)。 當(dāng)系統(tǒng)非常繁忙時,應(yīng)保證每個隊列的容量得到滿足,而如果每個隊列應(yīng)用程序較少,可將剩余資源共享給其他隊列。注意,所有隊列的容量之和應(yīng)小于100。
(2) maximum-capacity:隊列的資源使用上限(百分比)。由于存在資源共享,因此一個隊列使用的資源量可能超過其容量,而最多使用資源量可通過該參數(shù)限制。
m minimum-user-limit-percent:每個用戶***資源保障(百分比)。任何時刻,一個隊列中每個用戶可使用的資源量均有一定的限制。當(dāng)一個隊列中同時運行多個用戶的應(yīng)用程序時中,每個用戶的使用資源量在一個最小值和***值之間浮動,其中,最小值取決于正在運行的應(yīng)用程序數(shù)目,而***值則由minimum-user-limit-percent決定。比如,假設(shè)minimum-user-limit-percent為25。當(dāng)兩個用戶向該隊列提交應(yīng)用程序時,每個用戶可使用資源量不能超過50%,如果三個用戶提交應(yīng)用程序,則每個用戶可使用資源量不能超多33%,如果四個或者更多用戶提交應(yīng)用程序,則每個用戶可用資源量不能超過25%。
(3) user-limit-factor:每個用戶最多可使用的資源量(百分比)。比如,假設(shè)該值為30,則任何時刻,每個用戶使用的資源量不能超過該隊列容量的30%。
2. 限制應(yīng)用程序數(shù)目相關(guān)參數(shù)
(1) maximum-applications :集群或者隊列中同時處于等待和運行狀態(tài)的應(yīng)用程序數(shù)目上限,這是一個強限制,一旦集群中應(yīng)用程序數(shù)目超過該上限,后續(xù)提交的應(yīng)用程序?qū)⒈痪芙^,默認(rèn)值為 10000。所有隊列的數(shù)目上限可通過參數(shù)yarn.scheduler.capacity.maximum-applications設(shè)置(可看做默認(rèn) 值),而單個隊列可通過參數(shù)yarn.scheduler.capacity.<queue-path>.maximum- applications設(shè)置適合自己的值。
(2) maximum-am-resource-percent:集群中用于運行應(yīng)用程序 ApplicationMaster的資源比例上限,該參數(shù)通常用于限制處于活動狀態(tài)的應(yīng)用程序數(shù)目。該參數(shù)類型為浮點型,默認(rèn)是0.1,表示10%。所 有隊列的ApplicationMaster資源比例上限可通過參數(shù)yarn.scheduler.capacity. maximum-am-resource-percent設(shè)置(可看做默認(rèn)值),而單個隊列可通過參數(shù) yarn.scheduler.capacity.<queue-path>. maximum-am-resource-percent設(shè)置適合自己的值。
3. 隊列訪問和權(quán)限控制參數(shù)
(1) state :隊列狀態(tài)可以為STOPPED或者 RUNNING,如果一個隊列處于STOPPED狀態(tài),用戶不可以將應(yīng)用程序提交到該隊列或者它的子隊列中,類似的,如果ROOT隊列處于STOPPED 狀態(tài),用戶不可以向集群中提交應(yīng)用程序,但正在運行的應(yīng)用程序仍可以正常運行結(jié)束,以便隊列可以優(yōu)雅地退出。
(2) acl_submit_applications:限定哪些Linux用戶/用戶組可向給定隊列中提交應(yīng)用程序。需要注意的是,該屬性具有繼承性,即如果一個用戶可以向某個隊列中提交應(yīng)用程序,則它可以向它的所有子隊列中提交應(yīng)用程序。配置該屬性時,用戶之間或用戶組之間用“,”分割,用戶和用戶組之間用空格分割,比如“user1, user2 group1,group2”。
(3) acl_administer_queue:為隊列指定一個管理員,該管理員可控制該隊列的所有應(yīng)用程序,比如殺死任意一個應(yīng)用程序等。同樣,該屬性具有繼承性,如果一個用戶可以向某個隊列中提交應(yīng)用程序,則它可以向它的所有子隊列中提交應(yīng)用程序。
一個配置文件實例如下:
- <configuration>
- <property>
- <name>yarn.scheduler.capacity.maximum-applications</name>
- <value>10000</value>
- <description>最多可同時處于等待和運行狀態(tài)的應(yīng)用程序數(shù)目</description>
- </property>
- <property>
- <name>yarn.scheduler.capacity.maximum-am-resource-percent</name>
- <value>0.1</value>
- <description>集群中可用于運行application master的資源比例上限,這通常用于限制并發(fā)運行的應(yīng)用程序數(shù)目。</description>
- </property>
- <property>
- <name>yarn.scheduler.capacity.root.queues</name>
- <value>default</value>
- <description>root隊列的所有子隊列,該實例中只有一個</description>
- </property>
- <property>
- <name>yarn.scheduler.capacity.root.default.capacity</name>
- <value>100</value>
- <description>default隊列的資源容量</description>
- </property>
- <property>
- <name>yarn.scheduler.capacity.root.default.user-limit-factor</name>
- <value>1</value>
- <description>
- 每個用戶可使用的資源限制
- </description>
- </property>
- <property>
- <name>yarn.scheduler.capacity.root.default.maximum-capacity</name>
- <value>100</value>
- <description>
- Default隊列可使用的資源上限.
- </description>
- </property>
- <property>
- <name>yarn.scheduler.capacity.root.default.state</name>
- <value>RUNNING</value>
- <description>
- Default隊列的狀態(tài),可以是RUNNING或者STOPPED.
- </description>
- </property>
- <property>
- <name>yarn.scheduler.capacity.root.default.acl_submit_applications</name>
- <value>*</value>
- <description>
- 限制哪些用戶可向default隊列中提交應(yīng)用程序.
- </description>
- </property>
- <property>
- <name>yarn.scheduler.capacity.root.default.acl_administer_queue</name>
- <value>*</value>
- <description>
- 限制哪些用戶可管理default隊列中的應(yīng)用程序,“*”表示任意用戶
- </description>
- </property>
- <property>
- <name>yarn.scheduler.capacity.node-locality-delay</name>
- <value>-1</value>
- <description>調(diào)度器嘗試調(diào)度一個rack-local container之前,最多跳過的調(diào)度機會,通常而言,該值被設(shè)置成集群中機架數(shù)目,默認(rèn)情況下為-1,表示不啟用該功能。
- </description>
- </property>
- </configuration>
原文鏈接:http://dongxicheng.org/mapreduce-nextgen/hadoop-yarn-configurations-capacity-scheduler/