Skip to content

datafibers/hbase_java_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HBase Java API Demo

Explains how we can connect to HBase using Java and perform multiple operations on HBase tables.

Step 1

To connect to HBase using java we need a driver or connector to interact to HBase using Java. For that we will be using

<dependency>
	<groupId>org.apache.hbase</groupId>
	<artifactId>hbase-client</artifactId>
	<version>1.2.6</version>
</dependency>

Step 2

We need to create HBase Configuration by providing the following details

hbase.zookeeper.quorum
hbase.zookeeper.property.clientPort

or we need to provide the path to the files hbase-site.xml and core-site.xml from which it load the required configuration properties.

Note: Always prefer providing path to xml files over hbase zookeeper properties.

Step 3:

Execute following

java -cp target/java-hbase-jar-with-dependencies.jar com.datafibers.hbase.CreateTable

java -cp target/java-hbase-jar-with-dependencies.jar com.datafibers.hbase.ListTables

java -cp target/java-hbase-jar-with-dependencies.jar com.datafibers.hbase.InsertIntoTable

java -cp target/java-hbase-jar-with-dependencies.jar com.datafibers.hbase.ReadTable

java -cp target/java-hbase-jar-with-dependencies.jar com.datafibers.hbase.ScanTable

java -cp target/java-hbase-jar-with-dependencies.jar com.datafibers.hbase.FilterTable

java -cp target/java-hbase-jar-with-dependencies.jar com.datafibers.hbase.DeleteRecordsFromTable

java -cp target/java-hbase-jar-with-dependencies.jar com.datafibers.hbase.DeleteTable

About

hbase java api demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages