@InterfaceAudience.Private public class DistributedHBaseCluster extends HBaseCluster
conf, initialClusterStatus| Constructor and Description |
|---|
DistributedHBaseCluster(Configuration conf,
org.apache.hadoop.hbase.ClusterManager clusterManager) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes all the resources held open for this cluster.
|
AdminProtos.AdminService.BlockingInterface |
getAdminProtocol(ServerName serverName)
Returns an AdminProtocol interface to the regionserver
|
ClientProtos.ClientService.BlockingInterface |
getClientProtocol(ServerName serverName)
Returns a ClientProtocol interface to the regionserver
|
org.apache.hadoop.hbase.ClusterManager |
getClusterManager() |
ClusterStatus |
getClusterStatus()
Returns a ClusterStatus for this HBase cluster
|
ClusterStatus |
getInitialClusterStatus()
Returns a ClusterStatus for this HBase cluster as observed at the
starting of the HBaseCluster
|
MasterProtos.MasterService.BlockingInterface |
getMasterAdminService()
Returns an
MasterService.BlockingInterface to the active master |
ServerName |
getServerHoldingRegion(TableName tn,
byte[] regionName)
Get the ServerName of region server serving the specified region
|
boolean |
isDistributedCluster() |
void |
killMaster(ServerName serverName)
Kills the master process if this is a distributed cluster, otherwise,
this causes master to exit doing basic clean up only.
|
void |
killRegionServer(ServerName serverName)
Kills the region server process if this is a distributed cluster, otherwise
this causes the region server to exit doing basic clean up only.
|
protected boolean |
restoreAdmin() |
boolean |
restoreClusterStatus(ClusterStatus initial)
Restores the cluster to given state if this is a real cluster,
otherwise does nothing.
|
protected boolean |
restoreMasters(ClusterStatus initial,
ClusterStatus current) |
protected boolean |
restoreRegionServers(ClusterStatus initial,
ClusterStatus current) |
void |
setClusterManager(org.apache.hadoop.hbase.ClusterManager clusterManager) |
void |
shutdown()
Shut down the HBase cluster
|
void |
startMaster(java.lang.String hostname,
int port)
Starts a new master on the given hostname or if this is a mini/local cluster,
starts a master locally.
|
void |
startRegionServer(java.lang.String hostname,
int port)
Starts a new region server on the given hostname or if this is a mini/local cluster,
starts a region server locally.
|
void |
stopMaster(ServerName serverName)
Stops the given master, by attempting a gradual stop.
|
void |
stopRegionServer(ServerName serverName)
Stops the given region server, by attempting a gradual stop.
|
boolean |
waitForActiveAndReadyMaster(long timeout)
Blocks until there is an active master and that master has completed
initialization.
|
void |
waitForMasterToStop(ServerName serverName,
long timeout)
Wait for the specified master to stop the thread / process.
|
void |
waitForRegionServerToStop(ServerName serverName,
long timeout)
Wait for the specified region server to stop the thread / process.
|
void |
waitUntilShutDown()
Wait for HBase Cluster to shut down.
|
getConf, getServerHoldingMeta, restoreInitialStatus, setConf, waitForActiveAndReadyMaster, waitForDatanodesRegistered, waitForNamenodeAvailable, waitForRegionServerToStartpublic DistributedHBaseCluster(Configuration conf,
org.apache.hadoop.hbase.ClusterManager clusterManager)
throws java.io.IOException
java.io.IOExceptionpublic void setClusterManager(org.apache.hadoop.hbase.ClusterManager clusterManager)
public org.apache.hadoop.hbase.ClusterManager getClusterManager()
public ClusterStatus getClusterStatus() throws java.io.IOException
getClusterStatus in class HBaseClusterjava.io.IOExceptionHBaseCluster.getInitialClusterStatus()public ClusterStatus getInitialClusterStatus() throws java.io.IOException
HBaseClustergetInitialClusterStatus in class HBaseClusterjava.io.IOExceptionpublic void close()
throws java.io.IOException
HBaseClusterclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class HBaseClusterjava.io.IOExceptionHBaseCluster.shutdown()public AdminProtos.AdminService.BlockingInterface getAdminProtocol(ServerName serverName) throws java.io.IOException
HBaseClustergetAdminProtocol in class HBaseClusterjava.io.IOExceptionpublic ClientProtos.ClientService.BlockingInterface getClientProtocol(ServerName serverName) throws java.io.IOException
HBaseClustergetClientProtocol in class HBaseClusterjava.io.IOExceptionpublic void startRegionServer(java.lang.String hostname,
int port)
throws java.io.IOException
HBaseClusterstartRegionServer in class HBaseClusterhostname - the hostname to start the regionserver onjava.io.IOException - if something goes wrongpublic void killRegionServer(ServerName serverName) throws java.io.IOException
HBaseClusterkillRegionServer in class HBaseClusterjava.io.IOException - if something goes wrongpublic void stopRegionServer(ServerName serverName) throws java.io.IOException
HBaseClusterstopRegionServer in class HBaseClusterjava.io.IOException - if something goes wrongpublic void waitForRegionServerToStop(ServerName serverName, long timeout) throws java.io.IOException
HBaseClusterwaitForRegionServerToStop in class HBaseClusterjava.io.IOException - if something goes wrong or timeout occurspublic MasterProtos.MasterService.BlockingInterface getMasterAdminService() throws java.io.IOException
HBaseClusterMasterService.BlockingInterface to the active mastergetMasterAdminService in class HBaseClusterjava.io.IOExceptionpublic void startMaster(java.lang.String hostname,
int port)
throws java.io.IOException
HBaseClusterstartMaster in class HBaseClusterhostname - the hostname to start the master onjava.io.IOException - if something goes wrongpublic void killMaster(ServerName serverName) throws java.io.IOException
HBaseClusterkillMaster in class HBaseClusterjava.io.IOException - if something goes wrongpublic void stopMaster(ServerName serverName) throws java.io.IOException
HBaseClusterstopMaster in class HBaseClusterjava.io.IOException - if something goes wrongpublic void waitForMasterToStop(ServerName serverName, long timeout) throws java.io.IOException
HBaseClusterwaitForMasterToStop in class HBaseClusterjava.io.IOException - if something goes wrong or timeout occurspublic boolean waitForActiveAndReadyMaster(long timeout)
throws java.io.IOException
HBaseClusterwaitForActiveAndReadyMaster in class HBaseClustertimeout - the timeout limit in msjava.io.IOExceptionpublic ServerName getServerHoldingRegion(TableName tn, byte[] regionName) throws java.io.IOException
HBaseClustergetServerHoldingRegion in class HBaseClustertn - Table name that has the region.regionName - Name of the region in bytesjava.io.IOExceptionpublic void waitUntilShutDown()
HBaseClusterwaitUntilShutDown in class HBaseClusterpublic void shutdown()
throws java.io.IOException
HBaseClustershutdown in class HBaseClusterjava.io.IOExceptionpublic boolean isDistributedCluster()
isDistributedCluster in class HBaseClusterpublic boolean restoreClusterStatus(ClusterStatus initial) throws java.io.IOException
HBaseClusterrestoreClusterStatus in class HBaseClusterjava.io.IOExceptionprotected boolean restoreMasters(ClusterStatus initial, ClusterStatus current)
protected boolean restoreRegionServers(ClusterStatus initial, ClusterStatus current)
protected boolean restoreAdmin()
throws java.io.IOException
java.io.IOException