@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(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(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, waitForRegionServerToStart
public DistributedHBaseCluster(Configuration conf, org.apache.hadoop.hbase.ClusterManager clusterManager) throws IOException
IOException
public void setClusterManager(org.apache.hadoop.hbase.ClusterManager clusterManager)
public org.apache.hadoop.hbase.ClusterManager getClusterManager()
public ClusterStatus getClusterStatus() throws IOException
getClusterStatus
in class HBaseCluster
IOException
HBaseCluster.getInitialClusterStatus()
public ClusterStatus getInitialClusterStatus() throws IOException
HBaseCluster
getInitialClusterStatus
in class HBaseCluster
IOException
public void close() throws IOException
HBaseCluster
close
in interface Closeable
close
in interface AutoCloseable
close
in class HBaseCluster
IOException
HBaseCluster.shutdown()
public AdminProtos.AdminService.BlockingInterface getAdminProtocol(ServerName serverName) throws IOException
HBaseCluster
getAdminProtocol
in class HBaseCluster
IOException
public ClientProtos.ClientService.BlockingInterface getClientProtocol(ServerName serverName) throws IOException
HBaseCluster
getClientProtocol
in class HBaseCluster
IOException
public void startRegionServer(String hostname, int port) throws IOException
HBaseCluster
startRegionServer
in class HBaseCluster
hostname
- the hostname to start the regionserver onIOException
- if something goes wrongpublic void killRegionServer(ServerName serverName) throws IOException
HBaseCluster
killRegionServer
in class HBaseCluster
IOException
- if something goes wrongpublic void stopRegionServer(ServerName serverName) throws IOException
HBaseCluster
stopRegionServer
in class HBaseCluster
IOException
- if something goes wrongpublic void waitForRegionServerToStop(ServerName serverName, long timeout) throws IOException
HBaseCluster
waitForRegionServerToStop
in class HBaseCluster
IOException
- if something goes wrong or timeout occurspublic MasterProtos.MasterService.BlockingInterface getMasterAdminService() throws IOException
HBaseCluster
MasterService.BlockingInterface
to the active mastergetMasterAdminService
in class HBaseCluster
IOException
public void startMaster(String hostname, int port) throws IOException
HBaseCluster
startMaster
in class HBaseCluster
hostname
- the hostname to start the master onIOException
- if something goes wrongpublic void killMaster(ServerName serverName) throws IOException
HBaseCluster
killMaster
in class HBaseCluster
IOException
- if something goes wrongpublic void stopMaster(ServerName serverName) throws IOException
HBaseCluster
stopMaster
in class HBaseCluster
IOException
- if something goes wrongpublic void waitForMasterToStop(ServerName serverName, long timeout) throws IOException
HBaseCluster
waitForMasterToStop
in class HBaseCluster
IOException
- if something goes wrong or timeout occurspublic boolean waitForActiveAndReadyMaster(long timeout) throws IOException
HBaseCluster
waitForActiveAndReadyMaster
in class HBaseCluster
timeout
- the timeout limit in msIOException
public ServerName getServerHoldingRegion(TableName tn, byte[] regionName) throws IOException
HBaseCluster
getServerHoldingRegion
in class HBaseCluster
tn
- Table name that has the region.regionName
- Name of the region in bytesIOException
public void waitUntilShutDown()
HBaseCluster
waitUntilShutDown
in class HBaseCluster
public void shutdown() throws IOException
HBaseCluster
shutdown
in class HBaseCluster
IOException
public boolean isDistributedCluster()
isDistributedCluster
in class HBaseCluster
public boolean restoreClusterStatus(ClusterStatus initial) throws IOException
HBaseCluster
restoreClusterStatus
in class HBaseCluster
IOException
protected boolean restoreMasters(ClusterStatus initial, ClusterStatus current)
protected boolean restoreRegionServers(ClusterStatus initial, ClusterStatus current)
protected boolean restoreAdmin() throws IOException
IOException