The Management API of java operating HBase

Keywords: Java HBase

Management Java API of HBase

Abort the server or client.

void abort(String why,Throwable e)

Check if the server or client has been aborted.

boolean isAborted()  

Returns the connection used by this object.

Connection getConnection()

Judge whether the statement already exists. If it does not exist, create a table

boolean tableExists 

List all user space tables

#Out of date. Since version 2.0, will be removed in version 3.0 using listTableDescriptors().
HTableDescriptor[] listTables() 
HTableDescriptor[] listTables(String regex)
HTableDescriptor[] listTables(Pattern pattern,boolean includeSysTables)
List<TableDescriptor> listTableDescriptors()

#Regular matching queries all tables

#Out of date. Since version 2.0, it will be removed in version 3.0. 
HTableDescriptor[] listTables(Pattern pattern)throws IOException
#New version use
List<TableDescriptor> listTableDescriptors(Pattern pattern)throws IOException

Lists all the names of the user space table.

TableName[] listTableNames()
TableName[] listTableNames(Pattern pattern)
TableName[] listTableNames(String regex)
TableName[] listTableNames(Pattern pattern, boolean includeSysTables)

Gets the table descriptor.

#Out of date. Will be removed in version 3.0 since version 2.0
HTableDescriptor getTableDescriptor(TableName tableName)
#New version
TableDescriptor getDescriptor(TableName tableName)

Create table

void createTable(TableDescriptor desc)
void createTable(TableDescriptor desc, byte[] startKey, byte[] endKey,int numRegions)
void createTable(TableDescriptor desc, byte[][] splitKeys)
#Create table asynchronously
Future<Void> createTableAsync(HTableDescriptor desc, byte[][] splitKeys) 

Delete table

void deleteTable(TableName tableName)
#Asynchronous deletion
Future<Void> deleteTableAsync(TableName tableName)
#Out of date. Will be removed in version 3.0 since version 2.0
HTableDescriptor[] deleteTables(String regex)
HTableDescriptor[] deleteTables(Pattern pattern)

Truncate the table. Synchronization operation.

void truncateTable(TableName tableName,boolean preserveSplits)
#Asynchronous truncation
Future<Void> truncateTableAsync(TableName tableName,boolean preserveSplits)

Enable table

void enableTable(TableName tableName)
Future<Void> enableTableAsync(TableName tableName)
#Out of date. Will be removed in version 3.0 since version 2.0
HTableDescriptor[] enableTables(String regex)
HTableDescriptor[] enableTables(Pattern pattern)
#Is it enabled?
boolean isTableEnabled(TableName tableName)

Disabled table

#Out of date. Will be removed in version 3.0 since version 2.0
HTableDescriptor[] disableTables(String regex)
void disableTable(TableName tableName)
Future<Void> disableTableAsync(TableName tableName)
#Is it forbidden?
boolean isTableDisabled(TableName tableName)

#Availability
boolean isTableAvailable(TableName tableName)

Add a column family to an existing table

#Out of date. Will be removed in version 3.0 since version 2.0
default void addColumn(TableName tableName, ColumnFamilyDescriptor columnFamily)
#New version
void addColumnFamily(TableName tableName,ColumnFamilyDescriptor columnFamily)
#Asynchronous add
Future<Void> addColumnFamilyAsync(TableName tableName,ColumnFamilyDescriptor columnFamily)

Remove column from table

#Out of date. Will be removed in version 3.0 since version 2.0
void deleteColumn(TableName tableName,byte[] columnFamily)
void deleteColumnFamily(TableName tableName,byte[] columnFamily)
Future<Void> deleteColumnFamilyAsync(TableName tableName,byte[] columnFamily)

Modify an existing column on a table

default void modifyColumn(TableName tableName, ColumnFamilyDescriptor columnFamily)
void modifyColumnFamily(TableName tableName,ColumnFamilyDescriptor columnFamily)
Future<Void> modifyColumnFamilyAsync(TableName tableName,ColumnFamilyDescriptor columnFamily)

Posted by codygoodman on Sun, 05 Jan 2020 17:16:58 -0800