64
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.
- commons-loging-1.0.4
- commons-loging-api-1.0.4
- hadoop-core-0.20.2-cdh3u2
- hbase-0.90.4-cdh3u2
- log4j-1.2.15
- zookeper-3.3.3-cdh3u0
Program Code
Next TopicHive