HBase MapReduce简单实例
前言
在项目中使用到了HBase的MapReduce,写个小例子统计HBase table记录数
Mapper
需要继承 org.apache.hadoop.hbase.mapreduce.TableMapper 这个Mapper类,重写 map() 方法。
1 | public class CounterMapper extends TableMapper<Text, LongWritable> { |
Reducer
继承 org.apache.hadoop.mapreduce.Reducer 类,重写 reduce() 方法。
1 | public class CounterReducer extends Reducer<Text, LongWritable, Text, LongWritable> { |
job
1 | public class CounterJob { |