ITPub博客

首页 > 大数据 > Hadoop > 配置hadoop 使用fair scheduler调度器

配置hadoop 使用fair scheduler调度器

Hadoop 作者:破棉袄 时间:2014-08-08 16:59:13 0 删除 编辑

配置步骤为

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

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


  1. <property>  
  2.    <name>mapred.jobtracker.taskSchedulername>  
  3.    <value>org.apache.hadoop.mapred.FairSchedulervalue>  
  4.  property>  
  5.  <property>  
  6.      <name>mapred.fairscheduler.allocation.filename>  
  7.      <value>/home/hadoop/hadoop-0.20.2-cdh3u3/conf/fair-scheduler.xmlvalue>  
  8.   property>  
  9.   
  10.   <property>  
  11.     <name>mapred.fairscheduler.preemptionname>  
  12.     <value>truevalue>  
  13.   property>  
  14.   
  15.   <property>  
  16.     <name>mapred.fairscheduler.assignmultiplename>  
  17.     <value>truevalue>  
  18.   property>  
  19.   
  20.   <property>  
  21.     <name>mapred.fairscheduler.poolnamepropertyname>  
  22.     <value>mapred.queue.namevalue>  
  23.     <description>job.set("mapred.queue.name",pool); // pool is set to either 'high' or 'low' description>  
  24.   property>  
  25.   
  26.   <property>  
  27.     <name>mapred.fairscheduler.preemption.only.logname>  
  28.     <value>truevalue>  
  29.   property>  
  30.   
  31.   <property>  
  32.     <name>mapred.fairscheduler.preemption.intervalname>  
  33.     <value>15000value>  
  34.   property>  
  35.     
  36.   <property>  
  37.     <name>mapred.queue.namesname>  
  38.     <value>default,hadoop,hivevalue>  
  39.   property>  


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

      

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


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

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

设置hive的任务名称set mapred.job.name=goldts;

设置任务的优先级别set mapred.job.priority=HIGH;


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

  1. <property>  
  2.   <name>mapred.queue.default.acl-submit-jobname>  
  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-jobsname>  
  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>  

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29754888/viewspace-1248017/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-07-16

  • 博文量
    180
  • 访问量
    1158157