Java 如何最好地确定大型字符串的映射器输出/减缩器输入

Java 如何最好地确定大型字符串的映射器输出/减缩器输入,java,optimization,hadoop,hbase,hadoop-partitioning,Java,Optimization,Hadoop,Hbase,Hadoop Partitioning,我需要改进我的MR作业,它使用HBase作为源和汇 基本上,我从mapper中的3个HBase表中读取数据,将它们写成一个巨大的字符串,以便reducer进行一些计算并转储到HBase表中 Table1 ~ 19 million rows. Table2 ~ 2 million rows. Table3 ~ 900,000 rows. 映射器的输出如下所示: HouseHoldId contentID name duration genre type channelId personId te

我需要改进我的MR作业,它使用HBase作为源和汇

基本上,我从mapper中的3个HBase表中读取数据,将它们写成一个巨大的字符串,以便reducer进行一些计算并转储到HBase表中

Table1 ~ 19 million rows.
Table2 ~ 2 million rows.
Table3 ~ 900,000 rows.
映射器的输出如下所示:

HouseHoldId contentID name duration genre type channelId personId televisionID timestamp
这是表1的一行。同样,1900万地图绘制者产出

我感兴趣的是根据HouseHoldID值对它进行排序,所以我使用这种技术。我对配对的V部分不感兴趣,所以我忽略了它。 我的映射器类定义如下:

public static class AnalyzeMapper extends TableMapper<Text, IntWritable> { }
我的HBase表1有21个区域,因此产生了21个映射器。我们正在运行一个8节点的cloudera集群

我做错什么了吗


我应该使用自定义排序比较器、组比较器或类似的工具来提高效率吗?

您如何将HBase行转换为输出K,V type
。您是否能够发布mapper的map方法以提供更多上下文。除了对2200万行进行排序外,您的工作目标是什么?@ChrisWhite下面是详细的链接。。请给出你的见解!
scan.setCaching(750);        
scan.setCacheBlocks(false); 
TableMapReduceUtil.initTableMapperJob (
                                       Table1,           // input HBase table name
                                       scan,                   
                                       AnalyzeMapper.class,    // mapper
                                       Text.class,             // mapper output key
                                       IntWritable.class,      // mapper output value
                                       job);

TableMapReduceUtil.initTableReducerJob(
                                        OutputTable,                // output table
                                        AnalyzeReducerTable.class,  // reducer class
                                        job);
job.setNumReduceTasks(RegionCount);