HBase Admin API – Class Descriptor & Class HBaseAdmin
In this HBase tutorial, “HBase Admin API” we will introduce the class which represents the Admin in HBase, called as HBase Admin API. We will also cover the role of Class Descriptor in HBase. Here, along with the methods as well as their relevant descriptions. Also, we will see HBase admin example.
So, let’s start HBase Admin API tutorial.
What is HBase Admin API?
HBase permits Java API in communicating with HBase because HBase is written in Java. However, the fastest way to communicate with HBase is Java API. So, here, we are describing the referenced Java Admin API below, that covers the tasks used for managing tables.
Stay updated with latest technology trends
Join DataFlair on Telegram!!
A class which represents the Admin in HBase is HBaseAdmin. Basically, it is affiliated to the org.apache.hadoop.hbase.client package. However, a user can perform the tasks of an administrator, Using this class. Also by using Connection.getAdmin() method, they can get the instance of Admin.
a. Methods and Description
i. void createTable(HTableDescriptor desc)
In order to create a new table, we use this method.
ii. void createTable(HTableDescriptor desc, byte splitKeys)
However, it also creates a new table along with the initial set of empty regions which is defined by the specified split keys.
iii. void deleteColumn(byte tableName, String columnName)
Basically, to delete a column from a table, we use this method.
iv. void deleteColumn(String tableName, String columnName)
This method helps to delete a column from a table.
v. void deleteTable(String tableName)
The method, ‘void deleteTable” deletes a table.
Class Descriptor in HBase Admin API
As per its name, it consists of the details about an HBase table, like:
- About the descriptors of all the column families.
- Whether the table is a catalog table.
- Is the table is read-only?
- About the maximum size of the mem store.
- Also, it tells when the region split should occur.
- About the co-processors associated with it.
a. Constructor and Summary
Basically, it constructs a table descriptor specifying a TableName object.
b. Methods and Description
HTableDescriptor addFamily(HColumnDescriptor family)
In order to add a column family to the given descriptor, we use it.
So, this was all about HBase Admin API.
Conclusion: HBase Admin API
Hence, in this HBase Administration tutorial, we have seen the whole concept of HBase Admin API. Next, we will see HBase Client API. However, if any doubt occurs, regarding HBase Admin API, feel free to ask. We will definitely get back to you.