当前位置: 首页 > 文档资料 > Hadoop 中文文档 >

安装配置/MapReduce中公平调度器配置

优质
小牛编辑
124浏览
2023-12-01

一、背景

一般来说,JOB的执行就是FIFO的过程(先进先出),这样的方式资源得不到充分的使用。所以配置了一下公平调度。

二、配置实现

1、环境:hadoop0.20.2

2、拷贝/jz/hadoop-0.20.2/contrib/fairscheduler/hadoop-0.20.2-fairscheduler.jar到hadoop的lib目录下,并复制到集群所有机器上。

3、修改mapred-site.xml,内容如下:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
  <name>mapred.job.tracker</name>
  <value>m131:9001</value>
  <description>The host and port that the MapReduce job tracker runs
  at.  If "local", then jobs are run in-process as a single map
  and reduce task.
  </description>
</property>
<property>
<name>mapred.child.java.opts</name>
<value>-Xmx3072m</value>
</property>
<property>
  <name>mapred.tasktracker.map.tasks.maximum</name>
  <value>2</value>
  <description>The maximum number of map tasks that will be run
  simultaneously by a task tracker.
  </description>
</property>
<property>
  <name>mapred.jobtracker.taskScheduler</name>
  <!--<value>org.apache.hadoop.mapred.JobQueueTaskScheduler</value>-->
  <value>org.apache.hadoop.mapred.FairScheduler</value>
  <description>The class responsible for scheduling the tasks.</description>
</property>
</configuration>

4、重启集群服务,然后访问http://192.168.3.131:50030/scheduler显示页面

三、总结

1、更多的配置内容可以参看/jz/hadoop-0.20.2/docs/fair_scheduler.html文档

2、值得注意,使用公平调度可以并发的执行任务,但是执行的时间会延长。

3、总的来说,如果需要多任务同时运行,可以使用公平调度。但是如果任务有先后顺序性,建议还是使用FIFO的模式。