|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
org.apache.hadoop.hbase.master.HMaster
public class HMaster
HMaster is the "master server" for HBase. An HBase cluster has one active master. If many masters are started, all compete. Whichever wins goes on to run the cluster. All others park themselves in their constructor until master or cluster shutdown or until the active master loses its lease in zookeeper. Thereafter, all running master jostle to take over master role.
The Master can be asked shutdown the cluster. See shutdown(). In
this case it will tell all regionservers to go down and then wait on them
all reporting in that they are down. This master will then shut itself down.
You can also shutdown just this master. Call stopMaster().
HMasterInterface,
HMasterRegionInterface,
Watcher| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static java.lang.String |
MASTER
|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Fields inherited from interface org.apache.hadoop.hbase.ipc.HBaseRPCProtocolVersion |
|---|
versionID |
| Constructor Summary | |
|---|---|
HMaster(org.apache.hadoop.conf.Configuration conf)
Initializes the HMaster. |
|
| Method Summary | |
|---|---|
void |
abort(java.lang.String msg,
java.lang.Throwable t)
Abort the server or client. |
void |
addColumn(byte[] tableName,
HColumnDescriptor column)
Adds a column to the specified table |
protected HMsg[] |
adornRegionServerAnswer(HServerInfo hsi,
HMsg[] msgs)
Override if you'd add messages to return to regionserver hsi
or to send an exception. |
void |
assign(byte[] regionName,
boolean force)
Assign a region to a server chosen at random. |
void |
assignRegion(HRegionInfo hri)
|
boolean |
balance()
Run the balancer. |
boolean |
balanceSwitch(boolean b)
Turn the load balancer on or off. |
void |
checkTableModifiable(byte[] tableName)
Check table is modifiable; i.e. |
void |
clearFromTransition(HRegionInfo hri)
|
static HMaster |
constructMaster(java.lang.Class<? extends HMaster> masterClass,
org.apache.hadoop.conf.Configuration conf)
Utility for constructing an instance of the passed HMaster class. |
protected org.apache.hadoop.io.MapWritable |
createConfigurationSubset()
|
void |
createTable(HTableDescriptor desc,
byte[][] splitKeys)
Creates a new table. |
void |
createTable(HTableDescriptor desc,
byte[][] splitKeys,
boolean sync)
|
void |
deleteColumn(byte[] tableName,
byte[] c)
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) |
AssignmentManager |
getAssignmentManager()
|
CatalogTracker |
getCatalogTracker()
|
ClusterStatus |
getClusterStatus()
Return cluster status. |
org.apache.hadoop.conf.Configuration |
getConfiguration()
Gets the configuration object for this server. |
ExecutorService |
getExecutorService()
|
InfoServer |
getInfoServer()
|
HServerAddress |
getMasterAddress()
|
MasterFileSystem |
getMasterFileSystem()
|
long |
getProtocolVersion(java.lang.String protocol,
long clientVersion)
|
ServerManager |
getServerManager()
|
java.lang.String |
getServerName()
Gets the unique server name for this server. |
ZooKeeperWatcher |
getZooKeeper()
Gets the ZooKeeper instance for this server. |
ZooKeeperWatcher |
getZooKeeperWatcher()
Get the ZK wrapper object - needed by master_jsp.java |
boolean |
isActiveMaster()
Report whether this master is currently the active master or not. |
boolean |
isInitialized()
Report whether this master has completed with its initialization and is ready. |
boolean |
isMasterRunning()
|
boolean |
isStopped()
|
static void |
main(java.lang.String[] args)
|
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. |
HMsg[] |
regionServerReport(HServerInfo serverInfo,
HMsg[] msgs,
HRegionInfo[] mostLoadedRegions)
Called to renew lease, tell master what the region server is doing and to receive new instructions from the master |
org.apache.hadoop.io.MapWritable |
regionServerStartup(HServerInfo serverInfo,
long serverCurrentTime)
Called when a region server first starts |
void |
run()
Main processing loop for the HMaster. |
void |
setCatalogJanitorEnabled(boolean b)
Switch for the background CatalogJanitor thread. |
void |
shutdown()
Shutdown an HBase cluster. |
void |
stop(java.lang.String why)
Stop this service. |
void |
stopMaster()
Stop HBase Master only. |
void |
unassign(byte[] regionName,
boolean force)
Unassign a region from current hosting regionserver. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String MASTER
| Constructor Detail |
|---|
public HMaster(org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException,
org.apache.zookeeper.KeeperException,
java.lang.InterruptedException
Remaining steps of initialization occur in run() so that they
run in their own thread rather than within the context of the constructor.
java.lang.InterruptedException
java.io.IOException
org.apache.zookeeper.KeeperException| Method Detail |
|---|
public void run()
finishInitialization()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic HServerAddress getMasterAddress()
public long getProtocolVersion(java.lang.String protocol,
long clientVersion)
getProtocolVersion in interface org.apache.hadoop.ipc.VersionedProtocolpublic InfoServer getInfoServer()
public org.apache.hadoop.conf.Configuration getConfiguration()
Server
getConfiguration in interface Serverpublic ServerManager getServerManager()
getServerManager in interface MasterServicesServerManager instance.public ExecutorService getExecutorService()
getExecutorService in interface MasterServicesExecutorServicepublic MasterFileSystem getMasterFileSystem()
getMasterFileSystem in interface MasterServicesMasterFileSystem utility class.public ZooKeeperWatcher getZooKeeperWatcher()
public org.apache.hadoop.io.MapWritable regionServerStartup(HServerInfo serverInfo,
long serverCurrentTime)
throws java.io.IOException
HMasterRegionInterface
regionServerStartup in interface HMasterRegionInterfaceserverInfo - server infoserverCurrentTime - The current time of the region server in ms
java.io.IOException - eprotected org.apache.hadoop.io.MapWritable createConfigurationSubset()
public HMsg[] regionServerReport(HServerInfo serverInfo,
HMsg[] msgs,
HRegionInfo[] mostLoadedRegions)
throws java.io.IOException
HMasterRegionInterface
regionServerReport in interface HMasterRegionInterfaceserverInfo - server's address and start codemsgs - things the region server wants to tell the mastermostLoadedRegions - Array of HRegionInfos that should contain the
reporting server's most loaded regions. These are candidates for being
rebalanced.
java.io.IOException - e
protected HMsg[] adornRegionServerAnswer(HServerInfo hsi,
HMsg[] msgs)
throws java.io.IOException
hsi
or to send an exception.
msgs - Messages to add to
java.io.IOException - exceptions that were injected for the region serverspublic boolean isMasterRunning()
isMasterRunning in interface HMasterInterfacepublic boolean balance()
HMasterInterface
balance in interface HMasterInterfacepublic boolean balanceSwitch(boolean b)
HMasterInterface
balanceSwitch in interface HMasterInterfaceb - If true, enable balancer. If false, disable balancer.
public void setCatalogJanitorEnabled(boolean b)
CatalogJanitor thread.
Used for testing. The thread will continue to run. It will just be a noop
if disabled.
b - If false, the catalog janitor won't do anything.
public void move(byte[] encodedRegionName,
byte[] destServerName)
throws UnknownRegionException
HMasterInterfacer to dest.
move in interface HMasterInterfaceencodedRegionName - 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.
UnknownRegionException - Thrown if we can't find a region named
encodedRegionName
public void createTable(HTableDescriptor desc,
byte[][] splitKeys)
throws java.io.IOException
HMasterInterface
createTable in interface HMasterInterfacedesc - table descriptor
java.io.IOException
public void createTable(HTableDescriptor desc,
byte[][] splitKeys,
boolean sync)
throws java.io.IOException
java.io.IOException
public void deleteTable(byte[] tableName)
throws java.io.IOException
HMasterInterface
deleteTable in interface HMasterInterfacetableName - table to delete
java.io.IOException - e
public void addColumn(byte[] tableName,
HColumnDescriptor column)
throws java.io.IOException
HMasterInterface
addColumn in interface HMasterInterfacetableName - table to modifycolumn - column descriptor
java.io.IOException - e
public void modifyColumn(byte[] tableName,
HColumnDescriptor descriptor)
throws java.io.IOException
HMasterInterface
modifyColumn in interface HMasterInterfacetableName - table namedescriptor - new column descriptor
java.io.IOException - e
public void deleteColumn(byte[] tableName,
byte[] c)
throws java.io.IOException
HMasterInterface
deleteColumn in interface HMasterInterfacetableName - table to alterc - column family to remove
java.io.IOException - e
public void enableTable(byte[] tableName)
throws java.io.IOException
HMasterInterface
enableTable in interface HMasterInterfacetableName - table to enable
java.io.IOException - e
public void disableTable(byte[] tableName)
throws java.io.IOException
HMasterInterface
disableTable in interface HMasterInterfacetableName - table to take offline
java.io.IOException - e
public void modifyTable(byte[] tableName,
HTableDescriptor htd)
throws java.io.IOException
HMasterInterface
modifyTable in interface HMasterInterfacetableName - table to modifyhtd - new descriptor for table
java.io.IOException - e
public void checkTableModifiable(byte[] tableName)
throws java.io.IOException
MasterServices
checkTableModifiable in interface MasterServicestableName - Name of table to check.
TableNotDisabledException
TableNotFoundException
java.io.IOExceptionpublic void clearFromTransition(HRegionInfo hri)
public ClusterStatus getClusterStatus()
HMasterInterface
getClusterStatus in interface HMasterInterface
public void abort(java.lang.String msg,
java.lang.Throwable t)
Abortable
abort in interface Abortablemsg - Why we're aborting.t - Throwable that caused abort. Can be null.public ZooKeeperWatcher getZooKeeper()
Server
getZooKeeper in interface Serverpublic java.lang.String getServerName()
Server<hostname> ',' <port> ',' <startcode>.
If the master, it returns <hostname> ':' <port>'.
- Specified by:
getServerName in interface Server
- Returns:
- unique server name
public CatalogTracker getCatalogTracker()
getCatalogTracker in interface ServerCatalogTrackerpublic AssignmentManager getAssignmentManager()
getAssignmentManager in interface MasterServicesAssignmentManagerpublic void shutdown()
HMasterInterface
shutdown in interface HMasterInterfacepublic void stopMaster()
HMasterInterface
stopMaster in interface HMasterInterfacepublic void stop(java.lang.String why)
Stoppable
stop in interface Stoppablewhy - Why we're stopping.public boolean isStopped()
isStopped in interface StoppableStoppable.stop(String) has been closed.public boolean isActiveMaster()
public boolean isInitialized()
public void assign(byte[] regionName,
boolean force)
throws java.io.IOException
HMasterInterface
assign in interface HMasterInterfaceregionName - Region to assign. Will use existing RegionPlan if one
found.force - If true, will force the assignment.
java.io.IOExceptionpublic void assignRegion(HRegionInfo hri)
public void unassign(byte[] regionName,
boolean force)
throws java.io.IOException
HMasterInterfaceHMasterInterface.move(byte[], byte[]) if you want
to control the region movement.
unassign in interface HMasterInterfaceregionName - 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).
java.io.IOException
public static HMaster constructMaster(java.lang.Class<? extends HMaster> masterClass,
org.apache.hadoop.conf.Configuration conf)
masterClass - conf -
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.ExceptionHMasterCommandLine
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||