Yarn的资源调度与隔离

三种资源调度器介绍:

注意:Capacity Scheduler这个是雅虎公司分支(apache版本默认使用的容器调度器)

Fair scheduler这个是facebook公司分支(CDH版本默认使用的调度器)

注:DRF算法(主资源公平算法)
       作业1:cpu资源是主资源
       作业2:内存资源是主资源

FIFOScheduler原理:

Capacity Scheduler原理; 

Capacity Scheduler配置(capacity-scheduler.xml)
1、dev队列分成eng和science子队列
2、maxmum-capacity属性指定最大容量,不会占用其他资源
3、capacity容器还可以配置最大资源数、同时运行多少应用、队列的ACL认证
4、指定应用队列名称:mapreduce.job.queuename
<configuration>
    <property>
        <name>yarn.scheduler.capacity.root.queues</name>
        <value>prod,dev</value>
    </property>
    <property>
        <name>yarn.scheduler.capacity.root.dev.queues</name>
        <value>eng,science</value>
    </property>
    <property>
        <name>yarn.scheduler.capacity.root.prod.capacity</name>
        <value>40</value>
    </property>
    <property>
        <name>yarn.scheduler.capacity.root.dev.capacity</name>
        <value>60</value>
    </property>
    <property>
        <name>yarn.scheduler.capacity.root.dev.maximum-capacity</name>
        <value>75</value>
    </property>
    <property>
        <name>yarn.scheduler.capacity.root.dev.eng.capacity</name>
        <value>50</value>
    </property>
    <property>
        <name>yarn.scheduler.capacity.root.dev.science.capacity</name>
        <value>50</value>
    </property>

</configuration>

配置:yarn-site.xml

<property>
<name>yarn.resourcemanager.scheduler.class</name>
<value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler</value>
</property>

 Fair Scheduler原理: 

Fair Scheduler配置(fair-scheduler.xml)
1、每个队列中weight权重属性,作为公平调度的依据。若是动态划分,权重都是1
2、defaultQueueSchedulingPolicy属性配置队列内调度方式
3、每个队列中的schedulingPolicy属性配置该队列的调度方式,优先级高
4、Fair调度器会基于queuePolacementPolicy规则确定应用放到哪个队列
specified:应用指定队列名
primaryGroup:队列名为用户组的队列
user:队列名为用户的队列
default:指定队列
默认:specified、user、default
<?xml version="1.0"?>
<allocations>
<defaultQueueSchedulingPolicy>fair</defaultQueueSchedulingPolicy>
<queue name="prod">
    <weight>40</weight>
    <scheduling>fifo</scheduling>
</queue>
<queue name="dev">
    <weight>60</weight>
    <queue name="eng"></queue>
    <queue name="science"></queue>
</queue>
<queuePlacemenPolicy>
    <rule name="specified" create="false"></rule>
    <rule name="primaryGroup" create="false"></rule>
    <rule name="default" queue="dev.eng"></rule>
</queuePlacemenPolicy>
</allocations>

 查看调度器:
http://hadoop-senior01.test.com:8088中的scheduler

 

资源隔离(NodeManager) 

 

 

 

 

 

查看Yarn的隔离资源:
/etc/init.d/cgconfig restart

cd /cgroup

查看:

 

 参考地址:yarn使用cgroup隔离cpu资源 - 简书 (jianshu.com)icon-default.png?t=M276https://www.jianshu.com/p/e283ab7e2530

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值