org.apache.hadoop.hbase.ipc
Interface HMasterInterface

All Superinterfaces:
HBaseRPCProtocolVersion, org.apache.hadoop.ipc.VersionedProtocol
All Known Implementing Classes:
HMaster, HMasterCommandLine.LocalHMaster

public interface HMasterInterface
extends HBaseRPCProtocolVersion

Clients interact with the HMasterInterface to gain access to meta-level HBase functionality, like finding an HRegionServer and creating/destroying tables.

NOTE: if you change the interface, you must change the RPC version number in HBaseRPCProtocolVersion


Field Summary
 
Fields inherited from interface org.apache.hadoop.hbase.ipc.HBaseRPCProtocolVersion
versionID
 
Method Summary
 void addColumn(byte[] tableName, HColumnDescriptor column)
          Adds a column to the specified table
 void assign(byte[] regionName, boolean force)
          Assign a region to a server chosen at random.
 boolean balance()
          Run the balancer.
 boolean balanceSwitch(boolean b)
          Turn the load balancer on or off.
 void createTable(HTableDescriptor desc, byte[][] splitKeys)
          Creates a new table.
 void deleteColumn(byte[] tableName, byte[] columnName)
          Deletes a column from the specified table.
 void deleteTable(byte[] tableName)
          Deletes a table
 void disableTable(byte[] tableName)
          Take table offline
 void enableTable(byte[] tableName)
          Puts the table on-line (only needed if table has been previously taken offline)
 ClusterStatus getClusterStatus()
          Return cluster status.
 boolean isMasterRunning()
           
 void modifyColumn(byte[] tableName, HColumnDescriptor descriptor)
          Modifies an existing column on the specified table
 void modifyTable(byte[] tableName, HTableDescriptor htd)
          Modify a table's metadata
 void move(byte[] encodedRegionName, byte[] destServerName)
          Move the region r to dest.
 void shutdown()
          Shutdown an HBase cluster.
 void stopMaster()
          Stop HBase Master only.
 void unassign(byte[] regionName, boolean force)
          Unassign a region from current hosting regionserver.
 
Methods inherited from interface org.apache.hadoop.ipc.VersionedProtocol
getProtocolVersion
 

Method Detail

isMasterRunning

boolean isMasterRunning()
Returns:
true if master is available

createTable

void createTable(HTableDescriptor desc,
                 byte[][] splitKeys)
                 throws IOException
Creates a new table. If splitKeys are specified, then the table will be created with an initial set of multiple regions. If splitKeys is null, the table will be created with a single region.

Parameters:
desc - table descriptor
splitKeys -
Throws:
IOException

deleteTable

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

Parameters:
tableName - table to delete
Throws:
IOException - e

addColumn

void addColumn(byte[] tableName,
               HColumnDescriptor column)
               throws IOException
Adds a column to the specified table

Parameters:
tableName - table to modify
column - column descriptor
Throws:
IOException - e

modifyColumn

void modifyColumn(byte[] tableName,
                  HColumnDescriptor descriptor)
                  throws IOException
Modifies an existing column on the specified table

Parameters:
tableName - table name
descriptor - new column descriptor
Throws:
IOException - e

deleteColumn

void deleteColumn(byte[] tableName,
                  byte[] columnName)
                  throws IOException
Deletes a column from the specified table. Table must be disabled.

Parameters:
tableName - table to alter
columnName - column family to remove
Throws:
IOException - e

enableTable

void enableTable(byte[] tableName)
                 throws IOException
Puts the table on-line (only needed if table has been previously taken offline)

Parameters:
tableName - table to enable
Throws:
IOException - e

disableTable

void disableTable(byte[] tableName)
                  throws IOException
Take table offline

Parameters:
tableName - table to take offline
Throws:
IOException - e

modifyTable

void modifyTable(byte[] tableName,
                 HTableDescriptor htd)
                 throws IOException
Modify a table's metadata

Parameters:
tableName - table to modify
htd - new descriptor for table
Throws:
IOException - e

shutdown

void shutdown()
              throws IOException
Shutdown an HBase cluster.

Throws:
IOException - e

stopMaster

void stopMaster()
                throws IOException
Stop HBase Master only. Does not shutdown the cluster.

Throws:
IOException - e

getClusterStatus

ClusterStatus getClusterStatus()
Return cluster status.

Returns:
status object

move

void move(byte[] encodedRegionName,
          byte[] destServerName)
          throws UnknownRegionException
Move the region r to dest.

Parameters:
encodedRegionName - The encoded region name; i.e. the hash that makes up the region name suffix: e.g. if regionname is TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396., then the encoded region name is: 527db22f95c8a9e0116f0cc13c680396.
destServerName - The servername of the destination regionserver. If passed the empty byte array we'll assign to a random server. A server name is made of host, port and startcode. Here is an example: host187.example.com,60020,1289493121758.
Throws:
UnknownRegionException - Thrown if we can't find a region named encodedRegionName

assign

void assign(byte[] regionName,
            boolean force)
            throws IOException
Assign a region to a server chosen at random.

Parameters:
regionName - Region to assign. Will use existing RegionPlan if one found.
force - If true, will force the assignment.
Throws:
IOException

unassign

void unassign(byte[] regionName,
              boolean force)
              throws IOException
Unassign a region from current hosting regionserver. Region will then be assigned to a regionserver chosen at random. Region could be reassigned back to the same server. Use move(byte[], byte[]) if you want to control the region movement.

Parameters:
regionName - Region to unassign. Will clear any existing RegionPlan if one found.
force - If true, force unassign (Will remove region from regions-in-transition too if present).
Throws:
IOException

balance

boolean balance()
Run the balancer. Will run the balancer and if regions to move, it will go ahead and do the reassignments. Can NOT run for various reasons. Check logs.

Returns:
True if balancer ran and was able to tell the region servers to unassign all the regions to balance (the re-assignment itself is async), false otherwise.

balanceSwitch

boolean balanceSwitch(boolean b)
Turn the load balancer on or off.

Parameters:
b - If true, enable balancer. If false, disable balancer.
Returns:
Previous balancer value


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.