Database Reference
In-Depth Information
text.set(rowKey.toString());
context.write(text, ONE);
} catch (RuntimeException e) {
e.printStackTrace();
}
}
}
// Reducer Class
static class HBaseTestReducer extends
TableReducer<Text, IntWritable, ImmutableBytesWritable> {
protected void reduce(Text rowKey, Iterable<IntWritable> columns,
Context context) throws IOException, InterruptedException {
try {
for (IntWritable values : columns) {
System.out.println(values);
}
Put put = new Put(Bytes.toBytes(rowKey.toString()));
put.add(Bytes.toBytes("cf1"), Bytes.toBytes("col-1"),
Bytes.toBytes(rowKey.toString()));
context.write(null, put);
} catch (Exception e) {
e.printStackTrace();
}
}
}
// Main Driver Class
@SuppressWarnings("deprecation")
public static void main(String[] args) throws Exception {
try {
// Setup Configuraiton
Configuration config = new Configuration();
config.clear();
config.set("hbase.zookeeper.quorum", "localhost");
config.set("hbase.zookeeper.property.clientPort", "2181");
config.set("hbase.master", "localhost:60000");
 
Search WWH ::




Custom Search