본문으로 건너뛰기

스케줄링 설정

YARN 스케줄링 설정 방법과 작업 예제를 안내합니다.

YARN 스케줄러 설정​

YARN의 기본 스케줄러인 커패서티 스케줄러(Capacity Scheduler)와 페어 스케줄러(Fair Scheduler)를 설정하는 방법은 다음과 같습니다.

스케줄러 유형​

Capacity Scheduler​

Capacity Scheduler는 YARN의 기본 스케줄러로, 트리 형태의 큐를 선언하고 큐별로 사용 가능한 용량을 할당하여 YARN의 자원을 관리합니다.

Capacity Scheduler의 설정 키​
설정 키설정값
yarn.scheduler.capacity.maximum-applicationsPRE, RUNNING 상태로 설정될 수 있는 애플리케이션의 최대 개수
yarn.scheduler.capacity.maximum-am-resource-percent애플리케이션 마스터(AM)에 할당 가능한 최대 비율 설정
yarn.scheduler.capacity.root.queuesroot 큐에 등록하는 하부 큐의 이름 등록
yarn.scheduler.capacity.root.[큐이름].maximum-am-resource-percent큐에서 AM이 사용할 수 있는 자원의 비율
yarn.scheduler.capacity.root.[큐이름].capacity큐의 용량 비율
yarn.scheduler.capacity.root.[큐이름].user-limit-factor큐에 설정된 용량 limit-factor만큼 다른 큐의 용량을 사용할 수 있으나, maxmimum-capacity 이상으로는 이용할 수 없음
yarn.scheduler.capacity.root.[큐이름].maximum-capacity큐가 최대로 사용할 수 있는 용량
Capacity Scheduler 설정
<configuration>

<property>
<name>yarn.scheduler.capacity.maximum-applications</name>
<value>10000</value>
</property>

<property>
<name>yarn.scheduler.capacity.maximum-am-resource-percent</name>
<value>0.1</value>
</property>

<property>
<name>yarn.scheduler.capacity.resource-calculator</name>
<value>org.apache.hadoop.yarn.util.resource.DefaultResourceCalculator</value>
</property>

<property>
<name>yarn.scheduler.capacity.root.queues</name>
<value>prd,stg</value>
</property>

<property>
<name>yarn.scheduler.capacity.root.prd.capacity</name>
<value>80</value>
</property>

<property>
<name>yarn.scheduler.capacity.root.stg.capacity</name>
<value>20</value>
</property>

<property>
<name>yarn.scheduler.capacity.root.prd.user-limit-factor</name>
<value>1</value>
</property>

<property>
<name>yarn.scheduler.capacity.root.stg.user-limit-factor</user-limit-factor</name>
<value>2</value>
</property>

<property>
<name>yarn.scheduler.capacity.root.prd.maximum-capacity</name>
<value>100</value>
</property>

<property>
<name>yarn.scheduler.capacity.root.stg.maximum-capacity</name>
<value>30</value>
</property>

</configuration>

Fair Scheduler​

페어 스케줄러(Fair Scheduler)는 제출된 작업이 동등하게 리소스를 점유할 수 있도록 지원합니다. 큐에 작업이 제출되면 클러스터는 자원을 조절하여 모든 작업에 균등하게 자원을 할당합니다.

Fair scheduler의 설정 키설정값
yarn.scheduler.fair.allocation.fileFair Scheduler 설정 파일의 이름
yarn.scheduler.fair.user-as-default-queue큐트 이름을 지정하지 않았을 때 기본 큐어의 사용 여부
yarn.scheduler.fair.preemption우선순위 선점의 사용 여부
Fair Scheduler 설정 예제
<?xml version="1.0"?>
<allocations>
<queue name="dev">
<minResources>10000 mb,10vcores</minResources>
<maxResources>60000 mb,30vcores</maxResources>
<maxRunningApps>50</maxRunningApps>
<maxAMShare>1.0</maxAMShare>
<weight>2.0</weight>
<schedulingPolicy>fair</schedulingPolicy>
</queue>

<queue name="prd">
<minResources>10000 mb,10vcores</minResources>
<maxResources>60000 mb,30vcores</maxResources>
<maxRunningApps>100</maxRunningApps>
<maxAMShare>0.1</maxAMShare>
<weight>2.0</weight>
<schedulingPolicy>fair</schedulingPolicy>
<queue name="sub_prd">
<aclSubmitApps>charlie</aclSubmitApps>
<minResources>5000 mb,0vcores</minResources>
</queue>
</queue>


<user name="sample_user">
<maxRunningApps>30</maxRunningApps>
</user>
<userMaxAppsDefault>5</userMaxAppsDefault>

<queueMaxAMShareDefault>0.2</queueMaxAMShareDefault>

<queuePlacementPolicy>
<rule name="specified"/>
<rule name="primaryGroup" create="false"/>
<rule name="default" queue="dev"/>
</queuePlacementPolicy>
</allocations>

스케줄러 변경​

Hadoop Eco의 기본 스케줄러는 커패시티 스케줄러(Capacity Scheduler)입니다. 페어 스케줄러(Fair Scheduler)로 변경할 경우, yarn-site.xml 설정을 변경한 후 재실행해야 합니다.

스케줄러 변경 예제
<!--- 커패시티 스케줄러 --->
<property>
<name>yarn.resourcemanager.scheduler.class</name>
<value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler</value>
</property>

<!--- 페어 스케줄러 --->
<property>
<name>yarn.resourcemanager.scheduler.class</name>
<value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler</value>
</property>

스케줄러 설정 변경​

큐별 설정 내용을 변경 시 리소스 매니저가 운영 중에 설정을 변경할 수 있습니다. xml 파일의 설정 내용을 변경하고, 다음의 명령을 실행합니다.

스케줄러 설정 변경 예제
yarn rmadmin -refreshQueues