☰
In this tutorial, we’ll be looking at the HBase Java Client/Admin library classes. HBase is written in Java and provides Java API to communicate with it. Java API is the fastest way to communicate with HBase. Before we get into programs, let us see some of the important Classes/Interfaces that will be used later on.
HBaseAdmin is a class representing the Admin. This class belongs to the org.apache.hadoop.hbase.client package. HBaseAdmin is no longer a client API. It is marked InterfaceAudience.Private indicating that this is an HBase-internal class. Using this class, you can perform administrative tasks.
Some of the important Methods and Description of HBaseAdmin class are:
Add a column family to an existing table
Check if table exists or not
Creates a new table
Delete a column family from a table
Deletes a table
Disable table and wait on completion
Enable a table
Get the regions of a given table
List all the userspace tables
Major compact all regions on the region server
[Deprecated-will be removed in HBase 3.0.0]
HTableDescriptor contains the details about an HBase table such as the descriptors of all the column families, is the table a catalog table, -ROOT- or hbase:meta , if the table is read only, the maximum size of the memstore, when the region split should occur, coprocessors associated with it etc...
Some of the important Methods and Description of HTableDescriptor class are:
Adds a column family.
Returns an array all the HColumnDescriptor of the column families of the table.
Get the name of the table
Checks if the table is a hbase:meta table
As of HBase release 2.0.0, HTableDescriptor will be removed in HBase 3.0.0. Use TableDescriptorBuilder to build HTableDescriptor.
Adds HBase configuration files to a Configuration. This class belongs to the org.apache.hadoop.hbase package.
Some of the important Methods and Description of HBaseConfiguration class are:
Creates a Configuration with HBase resources
Merge two configurations.
An implementation of Table interface. Used to communicate with a single HBase table. Lightweight. Obtain an instance from a Connection and call close() afterwards. Table can be used to get, put, delete or scan data from a table.
Some of the important Methods and Description of HTable class are:
Deletes the specified cells/row.
Extracts certain cells from a given row.
Puts some data in the table.
Used to perform Put operations for a single row. It belongs to the org.apache.hadoop.hbase.client package.
Some of the important Methods and Description of Put class are:
Add the specified KeyValue to this Put operation.
Add the specified column and value to this Put operation.
Used to perform Get operations on a single row. Some of the important Methods and Description of Get class are:
Get the column from the specific family with the specified qualifier.
Get all columns from the specified family.
Used to perform Delete operations on a single row. Some of the important Methods and Description of Delete class are:
Add an existing delete marker to this Delete object.
Delete the latest version of the specified column.
Delete all versions of all columns of the specified family.
This class is used to get a single row result of a Get or a Scan query. Convenience methods are available in this class that return various Map structures and values directly. This class is NOT THREAD SAFE. Some of the important Methods and Description of Result class are:
Return the Cells for the specific column.
Map of qualifiers to values.
Method for retrieving the row key that corresponds to the row from which this Result was created.
Get the latest version of the specified column.