配置步骤为
1. 将$HADOOP_HOME/contrib/fairscheduler/hadoop-fairscheduler-0.20.2-cdh3u3.jar拷贝到$HADOOP_HOME/lib文件夹中
2. 修改$HADOOP_HOME/conf/mapred-site.xml配置文件
-
<property>
-
<name>mapred.jobtracker.taskSchedulername>
-
<value>org.apache.hadoop.mapred.FairSchedulervalue>
-
property>
-
<property>
-
<name>mapred.fairscheduler.allocation.filename>
-
<value>/home/hadoop/hadoop-0.20.2-cdh3u3/conf/fair-scheduler.xmlvalue>
-
property>
-
-
<property>
-
<name>mapred.fairscheduler.preemptionname>
-
<value>truevalue>
-
property>
-
-
<property>
-
<name>mapred.fairscheduler.assignmultiplename>
-
<value>truevalue>
-
property>
-
-
<property>
-
<name>mapred.fairscheduler.poolnamepropertyname>
-
<value>mapred.queue.namevalue>
-
<description>job.set("mapred.queue.name",pool); // pool is set to either 'high' or 'low' description>
-
property>
-
-
<property>
-
<name>mapred.fairscheduler.preemption.only.logname>
-
<value>truevalue>
-
property>
-
-
<property>
-
<name>mapred.fairscheduler.preemption.intervalname>
-
<value>15000value>
-
property>
-
-
<property>
-
<name>mapred.queue.namesname>
-
<value>default,hadoop,hivevalue>
-
property>
3. 在$HADOOP_HOME/conf/新建配置文件fair-scheduler.xml
-
xml version="1.0"?>
-
<allocations>
-
<pool name="hive">
-
<minMaps>90minMaps>
-
<minReduces>20minReduces>
-
<maxRunningJobs>20maxRunningJobs>
-
<weight>2.0weight>
-
<minSharePreemptionTimeout>30minSharePreemptionTimeout>
-
pool>
-
-
<pool name="hadoop">
-
<minMaps>9minMaps>
-
<minReduces>2minReduces>
-
<maxRunningJobs>20maxRunningJobs>
-
<weight>1.0weight>
-
<minSharePreemptionTimeout>30minSharePreemptionTimeout>
-
pool>
-
-
<user name="hadoop">
-
<maxRunningJobs>6maxRunningJobs>
-
user>
-
<poolMaxJobsDefault>10poolMaxJobsDefault>
-
<userMaxJobsDefault>8userMaxJobsDefault>
-
<defaultMinSharePreemptionTimeout>600defaultMinSharePreemptionTimeout>
-
<fairSharePreemptionTimeout>600fairSharePreemptionTimeout>
-
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里配置相应的属性,来对访问权限进行控制,比如:
-
<property>
-
<name>mapred.queue.default.acl-submit-jobname>
-
<value>*value>
-
<description> Comma separated list of user and group names that are allowed
-
to submit jobs to the 'default' queue. The user list and the group list
-
are separated by a blank. For e.g. user1,user2 group1,group2.
-
If set to the special value '*', it means all users are allowed to
-
submit jobs. If set to ' '(i.e. space), no user will be allowed to submit
-
jobs.
-
-
It is only used if authorization is enabled in Map/Reduce by setting the
-
configuration property mapred.acls.enabled to true.
-
-
Irrespective of this ACL configuration, the user who started the cluster and
-
cluster administrators configured via
-
mapreduce.cluster.administrators can submit jobs.
-
description>
-
property>
-
-
<property>
-
<name>mapred.queue.default.acl-administer-jobsname>
-
<value>*value>
-
<description> Comma separated list of user and group names that are allowed
-
to view job details, kill jobs or modify job's priority for all the jobs
-
in the 'default' queue. The user list and the group list
-
are separated by a blank. For e.g. user1,user2 group1,group2.
-
If set to the special value '*', it means all users are allowed to do
-
this operation. If set to ' '(i.e. space), no user will be allowed to do
-
this operation.
-
-
It is only used if authorization is enabled in Map/Reduce by setting the
-
configuration property mapred.acls.enabled to true.
-
-
Irrespective of this ACL configuration, the user who started the cluster and
-
cluster administrators configured via
-
mapreduce.cluster.administrators can do the above operations on all the jobs
-
in all the queues. The job owner can do all the above operations on his/her
-
job irrespective of this ACL configuration.
-
description>
-
property>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29754888/viewspace-1248017/
,如需转载,请注明出处,否则将追究法律责任。