trainingtrains Logo

91-9990449935

 0120-4256464

HBase Example

Let's see a HBase example to import data of a file in HBase table.

Use Case

We have to import data present in the file into an HBase table by creating it through Java API.

Data_file.txt contains the below data

The Java code is shown below

This data has to be inputted into a new HBase table to be created through JAVA API. Following column families have to be created

Column family region has three column qualifiers: country, state, city

Column family Time has two column qualifiers: year, month

Jar Files

Make sure that the following jars are present while writing the code as they are required by the HBase.

  1. commons-loging-1.0.4
  2. commons-loging-api-1.0.4
  3. hadoop-core-0.20.2-cdh3u2
  4. hbase-0.90.4-cdh3u2
  5. log4j-1.2.15
  6. zookeper-3.3.3-cdh3u0

Program Code

Next TopicHive