Big Data Hadoop & Spark

Hadoop Tutorial: HBase Admin DDL Commands (Java API)

In HBase, all the operations are done on tables and are very similar to MySQL. In this post, we will be using eclipse as IDE for writing  Java programs to interact with HBase.
Before going ahead with this post on DML commands in HBase, we request you to go through this post, HBase CRUD Operations.
We will be learning some of the admin commands to operate on tables, for which we need eclipse and HBase pre-installed in the Linux OS.
DDL commands are also called admin commands as it uses the database to do operations on the table and not inside the table, once we have tables and column family and rows we can go with DML commands which insert values and data inside table.
We will be learning simple Java APIs to perform DML operations.
On listing in HBase shell directly we find the below screenshot for the database.

 
CHECK HBASE RUNNING :
Here we learn to write java api for checking if Hbase is running.
We refer screenshot below to understand the code followed by code access for practice and result of it.

code
RESULT IF RUNNING:

RESULT IF NOT RUNNING:

 
CREATE:
Below is the  Java API for create command in Hbase.
We refer to screenshot below to understand the code followed by code access for practice and result of it.

code
RESULT

RESULT :
After running the code, you can find the table named ‘Prateek’ present in the database.

 
 
 
Hadoop
CHECK TABLE:
We will Java API for checking if a table already exists in Hbase.
Refer screenshot below to understand the code followed by code access for practice and result of it.

code
RESULT :

DISABLE TABLE :
Here we learn to write java api for disable table command in Hbase.
We refer screenshot below to understand the code followed by code access for practice and result of it.

code
RESULT :

ENABLE TABLE :
We will write Java API to enable table command in Hbase.
Refer screenshot below to understand the code followed by code access for practice and result of it.

code
RESULT :

LIST TABLES IN DATABASE :
We will write Java API for list command in Hbase.
Refer screenshot below to understand the code followed by code access for practice and result of it.

code
RESULT :

All above Java APIs are the functions available inside Hbase shell.
While writing  Java APIs what really comes in handy is function inside Hbase shell shown below.
DESCRIBE TABLE :
This command we can see directly in hbase shell to know details for a table.

We can see different flags for a table and their values respectively.
Hope this blog helped you in understanding HBase Admin DDL commands. In case of any queries, feel free to comment below and we will get back to you at the earliest. Keep visiting our website  for more updates on Big Data and other technologies. Click here to learn Big Data Hadoop Development.

Stay tuned to our blog for more posts like READ and WRITE operations in HBase.
Hadoop

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Close
Close