Performing Hbase operations in Java
Hbase provides a Java client with which we can perform operations similar to those performed through the command line.
Getting ready
To perform this recipe, you should have a running Hadoop cluster as well as the latest version of Hbase installed on it.
How to do it
To get started, we first need to create a maven project and add the Hbase client dependency:
<dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase-client</artifactId> <version>1.0.1.1</version> </dependency>
Now, we write a Java class, which uses APIs from the Hbase client to perform various operations:
package com.demo.hbase.hbase.client; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; ...
Get Hadoop: Data Processing and Modelling now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.