Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to limit the number of reduce jobs in mapreduce java code in hadoop

I'm new to Hadoop and I want to limit the number of reduce jobs in my application.

In the cluster, the maximum number of reduce jobs is 120. But, I don't want to use all of them, because my application doesn't need that many number of reduce jobs.

I tried the solution below, but it didn't change anything . My application still uses 120 reduce jobs.

How can I set the number of reduce jobs?

https://stackoverflow.com/questions/33237361/unable-to-set-mapreduce-job-reduces-through-generic-option-parser

Thanks for your response.

like image 389
seha Avatar asked Dec 10 '25 22:12

seha


2 Answers

From job class,

job.setNumReduceTasks(100);

From shell command

hadoop jar yourJar.jar -D mapred.reduce.tasks=1 <input> <output>
like image 111
Ramzy Avatar answered Dec 13 '25 12:12

Ramzy


Please check below values

With 1.x

mapred.reduce.tasks will take precedence unless you specify job.setNumReduceTasks(x);

With 2.x

mapreduce.job.reduces will take precedence unless you specify job.setNumReduceTasks(x);

You can implement suggestion by Ramzy with -D parameter. Check the hadoop version and respective property before you set the property.

Have a look at deprecated properties and new properties between 1.x and 2.x versions

like image 34
Ravindra babu Avatar answered Dec 13 '25 14:12

Ravindra babu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!