There's a limit for Hadoop counter size. It's 120 by default. I try to use the configuration "mapreduce.job.counters.limit" to change that, but it doesn't work. I've seen the source code. It's like the instance of JobConf in class "org.apache.hadoop.mapred.Counters" is private. Have anybody seen that before? What's your solution? THX :)
-
What version of Hadoop are you running? – HypnoticSheep Aug 27 '12 at 18:11
-
It's 0.20. Did you see that before? – size.of.world Aug 28 '12 at 02:45
-
I haven't run into the same problem (mainly since I haven't used counters much), but I'm using 1.0.3 and the JobConf stuff is different. Try Lorand's solution below, it looks like that will work. – HypnoticSheep Aug 28 '12 at 18:28
5 Answers
You can override that property in mapred-site.xml
on your JT, TT, client nodes but make sure that this will be a system-wide modification:
<configuration>
...
<property>
<name>mapreduce.job.counters.limit</name>
<value>500</value>
</property>
...
</configuration>
Then restart the mapreduce service on your cluster.

- 10,630
- 1
- 38
- 45
-
I tried your solution. It works. Thx :). I just wonder if there is a way to solve this problem dynamically. – size.of.world Aug 29 '12 at 03:48
-
In Hadoop 2, this configuration parameter is called
mapreduce.job.counters.max
Setting it on the command line or in your Configuration object isn't enough, though. You need to call the static method
org.apache.hadoop.mapreduce.counters.Limits.init()
in the setup() method of your mapper or reducer to get the setting to take effect.
Tested with 2.6.0 and 2.7.1.

- 2,601
- 1
- 18
- 9
The para is set by config file, while paras below will take effect
mapreduce.job.counters.max=1000
mapreduce.job.counters.groups.max=500
mapreduce.job.counters.group.name.max=1000
mapreduce.job.counters.counter.name.max=500

- 833
- 7
- 15
Just adding this in case anyone else faces the same problem we did: increasing the counters from with MRJob.
To raise the number of counters, add emr_configurations
to your mrjob.conf
(or pass it to MRJob as a config parameter):
runners:
emr:
emr_configurations:
- Classification: mapred-site
Properties:
mapreduce.job.counters.max: 1024
mapreduce.job.counters.counter.name.max: 256
mapreduce.job.counters.groups.max: 256
mapreduce.job.counters.group.name.max: 256

- 17,348
- 7
- 41
- 43
We can customize the limits as command line options only for specific jobs, instead of making change in mapred-site.xml
.
-Dmapreduce.job.counters.limit=x
-Dmapreduce.job.counters.groups.max=y
NOTE: x
and y
are custom values based on your environment/requirement.

- 13,254
- 9
- 50
- 73

- 470
- 4
- 10