What is HBase Admin API?
Apache HBase provides Java API to communicate with HBase and perform a different kinds of operations. Java APIs are the fastest way to communicate with HBase.
HBaseAdmin Class
HBaseAdmin represents the admin class in HBase and it belongs to org.apache.hadoop.hbase.client package. We can perform the task of an administrator using this class. To get the instance of Admin, we can use Connection.getAdmin() method.
Methods and Description
Methods | Description | void createTable(HTableDescriptor desc) | This method is used to create a new table. | void createTable(HTableDescriptor desc, byte[][] splitKeys) | This method is used to create a new table with an initial set of empty regions defined by the specified split keys. | void deleteColumn(byte[] tableName, String columnName) | This method is used delete a column from a table. | void deleteColumn(String tableName, String columnName) | This method is used to delete a column from a table. | void deleteTable(String tableName) | This method is used delete a table. |
---|
Class Descriptor in Admin API
Class Descriptor contains the information about HBase tables as mentioned below.
- It contains the descriptors of all the column families.
- Is the table is a catalog table?
- Whether the table is read-only?
- Contain information about the maximum size of the mem store.
- When the region split should occur.
- Information about co-processors associated with it.
Constructor and Summary
HTableDescriptor(TableName name) is used to constructs a table descriptor specifying a TableName object.
Methods and Description
HTableDescriptor addFamily(HColumnDescriptor family) is used to add a column family to the given descriptor.