org.apache.hadoop.hbase.client
Class HBaseAdmin

java.lang.Object
  extended by org.apache.hadoop.hbase.client.HBaseAdmin

public class HBaseAdmin
extends Object

Provides administrative functions for HBase


Constructor Summary
HBaseAdmin(HBaseConfiguration conf)
          Constructor
 
Method Summary
 void addColumn(byte[] tableName, HColumnDescriptor column)
          Add a column to an existing table
 void addColumn(String tableName, HColumnDescriptor column)
          Add a column to an existing table
 void addColumn(org.apache.hadoop.io.Text tableName, HColumnDescriptor column)
          Deprecated. Use String or byte [] overload instead
static void checkHBaseAvailable(HBaseConfiguration conf)
          Check to see if HBase is running.
 void createTable(HTableDescriptor desc)
          Creates a new table
 void createTableAsync(HTableDescriptor desc)
          Creates a new table but does not block and wait for it to come online.
 void deleteColumn(byte[] tableName, byte[] columnName)
          Delete a column from a table
 void deleteColumn(String tableName, String columnName)
          Delete a column from a table
 void deleteColumn(org.apache.hadoop.io.Text tableName, org.apache.hadoop.io.Text columnName)
          Deprecated. Use String or byte [] overload instead
 void deleteTable(byte[] tableName)
          Deletes a table
 void deleteTable(String tableName)
          Deletes a table
 void deleteTable(org.apache.hadoop.io.Text tableName)
          Deprecated. Use String or byte [] overload instead
 void disableTable(byte[] tableName)
          Disables a table (takes it off-line) If it is being served, the master will tell the servers to stop serving it.
 void disableTable(String tableName)
          Disables a table (takes it off-line) If it is being served, the master will tell the servers to stop serving it.
 void disableTable(org.apache.hadoop.io.Text tableName)
          Deprecated. Use String or byte [] overload instead
 void enableTable(byte[] tableName)
          Brings a table on-line (enables it)
 void enableTable(String tableName)
          Brings a table on-line (enables it)
 void enableTable(org.apache.hadoop.io.Text tableName)
          Deprecated. Use String or byte [] overload instead
 HMasterInterface getMaster()
           
 boolean isMasterRunning()
           
 boolean isTableEnabled(byte[] tableName)
           
 boolean isTableEnabled(String tableName)
           
 boolean isTableEnabled(org.apache.hadoop.io.Text tableName)
          Deprecated. Use String or byte [] overload instead
 HTableDescriptor[] listTables()
          List all the userspace tables.
 void modifyColumn(byte[] tableName, byte[] columnName, HColumnDescriptor descriptor)
          Modify an existing column family on a table
 void modifyColumn(String tableName, String columnName, HColumnDescriptor descriptor)
          Modify an existing column family on a table
 void modifyColumn(org.apache.hadoop.io.Text tableName, org.apache.hadoop.io.Text columnName, HColumnDescriptor descriptor)
          Deprecated. Use String or byte [] overload instead
 void modifyTableMeta(byte[] tableName, HTableDescriptor desc)
          Modify a table's HTableDescriptor
 void shutdown()
          Shuts down the HBase instance
 boolean tableExists(byte[] tableName)
           
 boolean tableExists(String tableName)
           
 boolean tableExists(org.apache.hadoop.io.Text tableName)
          Deprecated. Use String or byte [] overload instead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HBaseAdmin

public HBaseAdmin(HBaseConfiguration conf)
           throws MasterNotRunningException
Constructor

Parameters:
conf - Configuration object
Throws:
MasterNotRunningException
Method Detail

getMaster

public HMasterInterface getMaster()
                           throws MasterNotRunningException
Returns:
proxy connection to master server for this instance
Throws:
MasterNotRunningException

isMasterRunning

public boolean isMasterRunning()
Returns:
- true if the master server is running

tableExists

public boolean tableExists(org.apache.hadoop.io.Text tableName)
                    throws MasterNotRunningException
Deprecated. Use String or byte [] overload instead

Parameters:
tableName - Table to check.
Returns:
True if table exists already.
Throws:
MasterNotRunningException

tableExists

public boolean tableExists(String tableName)
                    throws MasterNotRunningException
Parameters:
tableName - Table to check.
Returns:
True if table exists already.
Throws:
MasterNotRunningException

tableExists

public boolean tableExists(byte[] tableName)
                    throws MasterNotRunningException
Parameters:
tableName - Table to check.
Returns:
True if table exists already.
Throws:
MasterNotRunningException

listTables

public HTableDescriptor[] listTables()
                              throws IOException
List all the userspace tables. In other words, scan the META table. If we wanted this to be really fast, we could implement a special catalog table that just contains table names and their descriptors. Right now, it only exists as part of the META table's region info.

Returns:
- returns an array of HTableDescriptors
Throws:
IOException

createTable

public void createTable(HTableDescriptor desc)
                 throws IOException
Creates a new table

Parameters:
desc - table descriptor for table
Throws:
IllegalArgumentException - if the table name is reserved
MasterNotRunningException - if master is not running
TableExistsException - if table already exists (If concurrent threads, the table may have been created between test-for-existence and attempt-at-creation).
IOException

createTableAsync

public void createTableAsync(HTableDescriptor desc)
                      throws IOException
Creates a new table but does not block and wait for it to come online.

Parameters:
desc - table descriptor for table
Throws:
IllegalArgumentException - Bad table name.
MasterNotRunningException - if master is not running
TableExistsException - if table already exists (If concurrent threads, the table may have been created between test-for-existence and attempt-at-creation).
IOException

deleteTable

public void deleteTable(org.apache.hadoop.io.Text tableName)
                 throws IOException
Deprecated. Use String or byte [] overload instead

Deletes a table

Parameters:
tableName - name of table to delete
Throws:
IOException

deleteTable

public void deleteTable(String tableName)
                 throws IOException
Deletes a table

Parameters:
tableName - name of table to delete
Throws:
IOException

deleteTable

public void deleteTable(byte[] tableName)
                 throws IOException
Deletes a table

Parameters:
tableName - name of table to delete
Throws:
IOException

enableTable

public void enableTable(org.apache.hadoop.io.Text tableName)
                 throws IOException
Deprecated. Use String or byte [] overload instead

Brings a table on-line (enables it)

Parameters:
tableName - name of the table
Throws:
IOException

enableTable

public void enableTable(String tableName)
                 throws IOException
Brings a table on-line (enables it)

Parameters:
tableName - name of the table
Throws:
IOException

enableTable

public void enableTable(byte[] tableName)
                 throws IOException
Brings a table on-line (enables it)

Parameters:
tableName - name of the table
Throws:
IOException

disableTable

public void disableTable(org.apache.hadoop.io.Text tableName)
                  throws IOException
Deprecated. Use String or byte [] overload instead

Disables a table (takes it off-line) If it is being served, the master will tell the servers to stop serving it.

Parameters:
tableName - name of table
Throws:
IOException

disableTable

public void disableTable(String tableName)
                  throws IOException
Disables a table (takes it off-line) If it is being served, the master will tell the servers to stop serving it.

Parameters:
tableName - name of table
Throws:
IOException

disableTable

public void disableTable(byte[] tableName)
                  throws IOException
Disables a table (takes it off-line) If it is being served, the master will tell the servers to stop serving it.

Parameters:
tableName - name of table
Throws:
IOException

isTableEnabled

public boolean isTableEnabled(org.apache.hadoop.io.Text tableName)
                       throws IOException
Deprecated. Use String or byte [] overload instead

Parameters:
tableName - name of table to check
Returns:
true if table is on-line
Throws:
IOException

isTableEnabled

public boolean isTableEnabled(String tableName)
                       throws IOException
Parameters:
tableName - name of table to check
Returns:
true if table is on-line
Throws:
IOException

isTableEnabled

public boolean isTableEnabled(byte[] tableName)
                       throws IOException
Parameters:
tableName - name of table to check
Returns:
true if table is on-line
Throws:
IOException

addColumn

public void addColumn(org.apache.hadoop.io.Text tableName,
                      HColumnDescriptor column)
               throws IOException
Deprecated. Use String or byte [] overload instead

Add a column to an existing table

Parameters:
tableName - name of the table to add column to
column - column descriptor of column to be added
Throws:
IOException

addColumn

public void addColumn(String tableName,
                      HColumnDescriptor column)
               throws IOException
Add a column to an existing table

Parameters:
tableName - name of the table to add column to
column - column descriptor of column to be added
Throws:
IOException

addColumn

public void addColumn(byte[] tableName,
                      HColumnDescriptor column)
               throws IOException
Add a column to an existing table

Parameters:
tableName - name of the table to add column to
column - column descriptor of column to be added
Throws:
IOException

deleteColumn

public void deleteColumn(org.apache.hadoop.io.Text tableName,
                         org.apache.hadoop.io.Text columnName)
                  throws IOException
Deprecated. Use String or byte [] overload instead

Delete a column from a table

Parameters:
tableName - name of table
columnName - name of column to be deleted
Throws:
IOException

deleteColumn

public void deleteColumn(String tableName,
                         String columnName)
                  throws IOException
Delete a column from a table

Parameters:
tableName - name of table
columnName - name of column to be deleted
Throws:
IOException

deleteColumn

public void deleteColumn(byte[] tableName,
                         byte[] columnName)
                  throws IOException
Delete a column from a table

Parameters:
tableName - name of table
columnName - name of column to be deleted
Throws:
IOException

modifyColumn

public void modifyColumn(org.apache.hadoop.io.Text tableName,
                         org.apache.hadoop.io.Text columnName,
                         HColumnDescriptor descriptor)
                  throws IOException
Deprecated. Use String or byte [] overload instead

Modify an existing column family on a table

Parameters:
tableName - name of table
columnName - name of column to be modified
descriptor - new column descriptor to use
Throws:
IOException

modifyColumn

public void modifyColumn(String tableName,
                         String columnName,
                         HColumnDescriptor descriptor)
                  throws IOException
Modify an existing column family on a table

Parameters:
tableName - name of table
columnName - name of column to be modified
descriptor - new column descriptor to use
Throws:
IOException

modifyColumn

public void modifyColumn(byte[] tableName,
                         byte[] columnName,
                         HColumnDescriptor descriptor)
                  throws IOException
Modify an existing column family on a table

Parameters:
tableName - name of table
columnName - name of column to be modified
descriptor - new column descriptor to use
Throws:
IOException

modifyTableMeta

public void modifyTableMeta(byte[] tableName,
                            HTableDescriptor desc)
                     throws IOException
Modify a table's HTableDescriptor

Parameters:
tableName - name of table
desc - the updated descriptor
Throws:
IOException

shutdown

public void shutdown()
              throws IOException
Shuts down the HBase instance

Throws:
IOException

checkHBaseAvailable

public static void checkHBaseAvailable(HBaseConfiguration conf)
                                throws MasterNotRunningException
Check to see if HBase is running. Throw an exception if not.

Parameters:
conf -
Throws:
MasterNotRunningException


Copyright © 2008 The Apache Software Foundation