Data random access using Java client APIs

The previous recipe introduced the command-line interface for HBase. This recipe demonstrates how we can use the Java API to interact with HBase.

Getting ready

This recipe requires an Apache HBase installation integrated with a Hadoop YARN cluster. Make sure to start all the configured HBase Master and RegionServer processes before we begin.

How to do it...

The following step executes an HBase Java client to store and retrieve data from an HBase table.

Run the HBaseClient Java program by running the following command from the chapter 7 folder of the sample source repository:

$ gradle execute HBaseClient

How it works...

The source code for the preceding Java program is available in the chapter7/src/chapter7/hbase/HBaseClient.java ...

Get Hadoop MapReduce v2 Cookbook - Second Edition 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.