HBase 批量加载(使用 configureIncrementalLoad 辅助方法)将作业配置为创建与 hbase 表中的区域一样多的 reducer 任务。因此,如果有几百个区域,那么该作业将产生几百个 reducer 任务。在小型集群上这可能会变得非常慢..
使用 MultipleOutputFormat 或其他方法是否有任何解决方法?
谢谢
很容易出现网络瓶颈。确保您正在压缩 HFile 和中间 MR 数据。
job.getConfiguration().setBoolean("mapred.compress.map.output", true);
job.getConfiguration().setClass("mapred.map.output.compression.codec",
org.apache.hadoop.io.compress.GzipCodec.class,
org.apache.hadoop.io.compress.CompressionCodec.class);
job.getConfiguration().set("hfile.compression",
Compression.Algorithm.LZO.getName());
您的数据导入大小可能足够小,您应该考虑使用基于 Put 的格式。这将调用普通的 HTable.Put API 并跳过 reducer 阶段。请参阅 TableMapReduceUtil.initTableReducerJob(table, null, job)。
当我们使用 HFileOutputFormat 时,无论您设置什么,它都会覆盖减速器的数量。reducer 的数量等于该 HBase 表中的区域数。因此,如果您想控制减速器的数量,请减少区域的数量。
您将在此处找到示例代码:
希望这会有用:)