hbase org.apache.hadoop.hbase.mapreduce.ImportTsv -Dimporttsv.mapper.class=org.apache.hadoop.hbase.mapreduce.TsvImporterUserMapper -Dimporttsv.bulk.output=/test/hello -Dimporttsv.separator="," -Dimporttsv.columns=HBASE_ROW_KEY,hello:Name1,hello:Name2,hello:Amount1,hello:Amount2 hello_tb /hello.data
hbase org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles /test/hello hello_tb
使用自定义的导入Mapper:
@Override
public void map(LongWritable offset, Text value,
Context context)
throws IOException {
byte[] lineBytes = value.getBytes();
通过修改map函数可以改rowkey的格式。转化成我们需要的格式。
在hbase-mapreduce里maven打包,传到/hbase/lib下即可使用。