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 Java programs.
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 database to do operations on table and not inside table, once we have tables and column family and rows we can go with DML commands which insert values and data inside table.
Here we will be learning simple java APi to perform DML operations.
On listing in HBase shell directly we find the below screenshot for the database.
CREATE:
Here we learn to write java api for create command in Hbase.
We refer screenshot below to understand the code followed by code access for practice and result of it.
RESULT
RESULT :
You can find table Prateek in database present after running above code.
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.
RESULT IF RUNNING:
RESULT IF NOT RUNNING :
CHECK TABLE :
Here we learn to write java api for checking if table already exist in Hbase.
We refer screenshot below to understand the code followed by code access for practice and result of it.
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.
RESULT :
ENABLE TABLE :
Here we learn to write java api for enable table command in Hbase.
We refer screenshot below to understand the code followed by code access for practice and result of it.
code
RESULT :
LIST TABLES IN DATABASE :
Here we learn to write Java API for list command in Hbase.
We refer screenshot below to understand the code followed by code access for practice and result of it.
RESULT :
All above Java APIs are the functions available inside Hbase sheel.
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.
Here we can see the different flags for table and there values.
Hope we had been clear in explaining the various HBase Admin DDL commands. In the case of any queries, feel free to comment below and we will get back to you at the earliest.
Stay tuned to our blog for more posts like READ and WRITE operations in HBase.
Leave a Reply