MapReduce计数器个数上限

mac2026-05-14  4

最近使用MapReduce进行统计工作,需要使用MapReduce的动态计数器,也就是如下代码示例。

public class MyCounterMap extends Mapper<LongWritable, Text, Text, Text> { protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { for(int i = 0; i < 1000; i++) { context.getCounter("MAX_NUM",i).increment(1); } } }

然后每组需要使用的计数器个数很多,怕框架设计的不够用,就自己测试了一下,i=500就会报错了(忘记留截图了)。

所以,同组计数器个数上限为500,之前中文网站没有搜到相关资料,所以记录一下。

最新回复(0)