配置hadoop 使用fair scheduler调度器

来源:互联网 发布:mac日历添加美国节日 编辑:程序博客网 时间:2024/05/17 23:35

hadoop版本为cloudera hadoop cdh3u3

配置步骤为

1.  将$HADOOP_HOME/contrib/fairscheduler/hadoop-fairscheduler-0.20.2-cdh3u3.jar拷贝到$HADOOP_HOME/lib文件夹中

2.  修改$HADOOP_HOME/conf/mapred-site.xml配置文件

[html] view plaincopy
  1. <property>  
  2.    <name>mapred.jobtracker.taskScheduler</name>  
  3.    <value>org.apache.hadoop.mapred.FairScheduler</value>  
  4.  </property>  
  5.  <property>  
  6.      <name>mapred.fairscheduler.allocation.file</name>  
  7.      <value>/home/hadoop/hadoop-0.20.2-cdh3u3/conf/fair-scheduler.xml</value>  
  8.   </property>  
  9.   
  10.   <property>  
  11.     <name>mapred.fairscheduler.preemption</name>  
  12.     <value>true</value>  
  13.   </property>  
  14.   
  15.   <property>  
  16.     <name>mapred.fairscheduler.assignmultiple</name>  
  17.     <value>true</value>  
  18.   </property>  
  19.   
  20.   <property>  
  21.     <name>mapred.fairscheduler.poolnameproperty</name>  
  22.     <value>mapred.job.queue.name</value>  
  23.     <description>job.set("mapred.job.queue.name",pool); </description>  
  24.   </property>  
  25.   
  26.   <property>  
  27.     <name>mapred.fairscheduler.preemption.only.log</name>  
  28.     <value>true</value>  
  29.   </property>  
  30.   
  31.   <property>  
  32.     <name>mapred.fairscheduler.preemption.interval</name>  
  33.     <value>15000</value>  
  34.   </property>  
  35.     
  36.   <property>  
  37.     <name>mapred.queue.names</name>  
  38.     <value>default,hadoop,hive</value>  
  39.   </property>  

3.  在$HADOOP_HOME/conf/新建配置文件fair-scheduler.xml

[html] view plaincopy
  1. <?xml version="1.0"?>  
  2. <allocations>  
  3. <pool name="hive">  
  4.   <minMaps>90</minMaps>  
  5.   <minReduces>20</minReduces>  
  6.   <maxRunningJobs>20</maxRunningJobs>  
  7.   <weight>2.0</weight>  
  8.   <minSharePreemptionTimeout>30</minSharePreemptionTimeout>  
  9. </pool>  
  10.   
  11. <pool name="hadoop">  
  12.   <minMaps>9</minMaps>  
  13.   <minReduces>2</minReduces>  
  14.   <maxRunningJobs>20</maxRunningJobs>  
  15.   <weight>1.0</weight>  
  16.   <minSharePreemptionTimeout>30</minSharePreemptionTimeout>  
  17. </pool>  
  18.   
  19. <user name="hadoop">  
  20.     <maxRunningJobs>6</maxRunningJobs>  
  21. </user>  
  22. <poolMaxJobsDefault>10</poolMaxJobsDefault>  
  23. <userMaxJobsDefault>8</userMaxJobsDefault>  
  24. <defaultMinSharePreemptionTimeout>600</defaultMinSharePreemptionTimeout>  
  25. <fairSharePreemptionTimeout>600</fairSharePreemptionTimeout>  
  26. </allocations>  

4.  在集群的各个节点执行以上步骤,然后重启集群,在http://namenode:50030/scheduler  即可查看到调度器运行状态,如果修改调度器配置的话,只需要修改文件fair-scheduler.xml ,不需重启配置即可生效。

5. 在执行hive任务时,设置hive属于的队列set mapred.job.queue.name=hive;

##########

另外,如果在执行MR JOB的时候出现XX用户访问不了YY队列的话,就需要在mapred-queue-acls.xml里配置相应的属性,来对访问权限进行控制,比如:

[html] view plaincopy
  1. <property>  
  2.   <name>mapred.queue.default.acl-submit-job</name>  
  3.   <value>*</value>  
  4.   <description> Comma separated list of user and group names that are allowed  
  5.     to submit jobs to the 'default' queue. The user list and the group list  
  6.     are separated by a blank. For e.g. user1,user2 group1,group2.  
  7.     If set to the special value '*', it means all users are allowed to  
  8.     submit jobs. If set to ' '(i.e. space), no user will be allowed to submit  
  9.     jobs.  
  10.   
  11.     It is only used if authorization is enabled in Map/Reduce by setting the  
  12.     configuration property mapred.acls.enabled to true.  
  13.   
  14.     Irrespective of this ACL configuration, the user who started the cluster and  
  15.     cluster administrators configured via  
  16.     mapreduce.cluster.administrators can submit jobs.  
  17.   </description>  
  18. </property>  
  19.   
  20. <property>  
  21.   <name>mapred.queue.default.acl-administer-jobs</name>  
  22.   <value>*</value>  
  23.   <description> Comma separated list of user and group names that are allowed  
  24.     to view job details, kill jobs or modify job's priority for all the jobs  
  25.     in the 'default' queue. The user list and the group list  
  26.     are separated by a blank. For e.g. user1,user2 group1,group2.  
  27.     If set to the special value '*', it means all users are allowed to do  
  28.     this operation. If set to ' '(i.e. space), no user will be allowed to do  
  29.     this operation.  
  30.   
  31.     It is only used if authorization is enabled in Map/Reduce by setting the  
  32.     configuration property mapred.acls.enabled to true.  
  33.   
  34.     Irrespective of this ACL configuration, the user who started the cluster and  
  35.     cluster administrators configured via  
  36.     mapreduce.cluster.administrators can do the above operations on all the jobs  
  37.     in all the queues. The job owner can do all the above operations on his/her  
  38.     job irrespective of this ACL configuration.  
  39.   </description>  
  40. </property>  
0 0
原创粉丝点击