Configuration config = HBaseConfiguration.create();
Job job = new Job(config, "ExampleRead");
job.setJarByClass(MyReadJob.class); // class that contains mapper
Scan scan = new Scan();
scan.setCaching(500); // 1 is the default in Scan, which will be bad for MapReduce jobs
scan.setCacheBlocks(false); // don't set to true for MR jobs
// set other scan attrs
...
TableMapReduceUtil.initTableMapperJob(
tableName, // input HBase table name
scan, // Scan instance to control CF and attribute selection
MyMapper.class, // mapper
null, // mapper output key
null, // mapper output value
job);
job.setOutputFormatClass(NullOutputFormat.class); // because we aren't emitting anything from mapper
boolean b = job.waitForCompletion(true);
if (!b) {
throw new IOException("error with job!");
}
hbase中的 TableScanMR 使用方法是什么?
5之前看网上的大佬说:“HBase中Scan从大的层面来看主要有三种常见用法:ScanAPI、TableScanMR以及SnapshotScanMR。”但是我想知道TableScanMR和SnapshotScanMR 是怎么实现的呢?
- 点赞
- 写回答
- 关注问题
- 收藏
- 复制链接分享
- 邀请回答
3条回答
为你推荐
- hbase中的 TableScanMR 使用方法是什么?
- nosql
- 3个回答