HBase大表快速统计

https://blog.csdn.net/hxpjava1 ... 97074
这种代码是放在哪里运行的?
已邀请:

qilangye

赞同来自:

public class TestCounter { private static final byte TABLE_NAME = Bytes.toBytes("TestTable"); public static class TestMapper extends TableMapper<Text, LongWritable> { public void map(ImmutableBytesWritable key, Result result, Context context) throws IOException, InterruptedException { context.getCounter("TestRowCounter", "Test Row Counter").increment(1); } } public static void main(String args) throws Exception { Configuration conf = HBaseConfiguration.create(); Job job = new Job(conf); Scan scan = new Scan(); scan.setCaching(100); scan.setCacheBlocks(false); job.setSpeculativeExecution(false); job.setJarByClass(TestCounter.class); job.setMapperClass(TestMapper.class); job.setMapOutputValueClass(LongWritable.class); job.setOutputFormatClass(TextOutputFormat.class); TableMapReduceUtil.initTableMapperJob(TABLE_NAME, scan, TestMapper.class, Text.class, LongWritable.class, job); TableMapReduceUtil.initTableReducerJob(Bytes.toString(TABLE_NAME), null, job); if (!job.waitForCompletion(true)) { System.out.println("wait job complete failed."); } } }
 
 
 
这种代码是放在哪里运行的呢

要回复问题请先登录注册