@InterfaceAudience.Private public class DistributedHBaseCluster extends HBaseCluster
Modifier and Type | Class and Description |
---|---|
private static class |
DistributedHBaseCluster.ServerNameIgnoreStartCodeComparator |
Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.hbase.client.Admin |
admin |
private ClusterManager |
clusterManager |
private org.apache.hadoop.hbase.client.Connection |
connection |
private Set<org.apache.hadoop.hbase.ServerName> |
killedRegionServers
List of RegionServers killed so far.
|
conf, initialClusterStatus, LOG
Constructor and Description |
---|
DistributedHBaseCluster(org.apache.hadoop.conf.Configuration conf,
ClusterManager clusterManager) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes all the resources held open for this cluster.
|
org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface |
getAdminProtocol(org.apache.hadoop.hbase.ServerName serverName)
Returns an AdminProtocol interface to the regionserver
|
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface |
getClientProtocol(org.apache.hadoop.hbase.ServerName serverName)
Returns a ClientProtocol interface to the regionserver
|
ClusterManager |
getClusterManager() |
org.apache.hadoop.hbase.ClusterMetrics |
getClusterMetrics()
Returns a ClusterStatus for this HBase cluster
|
org.apache.hadoop.hbase.ClusterMetrics |
getInitialClusterMetrics()
Returns a ClusterStatus for this HBase cluster as observed at the
starting of the HBaseCluster
|
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.BlockingInterface |
getMasterAdminService()
Returns an
MasterService.BlockingInterface to the active master |
org.apache.hadoop.hbase.ServerName |
getServerHoldingRegion(org.apache.hadoop.hbase.TableName tn,
byte[] regionName)
Get the ServerName of region server serving the specified region
|
boolean |
isDistributedCluster() |
boolean |
isKilledRS(org.apache.hadoop.hbase.ServerName serverName)
Keeping track of killed servers and being able to check if a particular server was killed makes
it possible to do fault tolerance testing for dead servers in a deterministic way.
|
void |
killDataNode(org.apache.hadoop.hbase.ServerName serverName)
Kills the datanode process if this is a distributed cluster, otherwise,
this causes master to exit doing basic clean up only.
|
void |
killMaster(org.apache.hadoop.hbase.ServerName serverName)
Kills the master process if this is a distributed cluster, otherwise,
this causes master to exit doing basic clean up only.
|
void |
killNameNode(org.apache.hadoop.hbase.ServerName serverName)
Kills the namenode process if this is a distributed cluster, otherwise, this causes master to
exit doing basic clean up only.
|
void |
killRegionServer(org.apache.hadoop.hbase.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.
|
void |
killZkNode(org.apache.hadoop.hbase.ServerName serverName)
Kills the zookeeper node process if this is a distributed cluster, otherwise,
this causes master to exit doing basic clean up only.
|
protected boolean |
restoreAdmin() |
boolean |
restoreClusterMetrics(org.apache.hadoop.hbase.ClusterMetrics initial)
Restores the cluster to given state if this is a real cluster,
otherwise does nothing.
|
protected boolean |
restoreMasters(org.apache.hadoop.hbase.ClusterMetrics initial,
org.apache.hadoop.hbase.ClusterMetrics current) |
protected boolean |
restoreRegionServers(org.apache.hadoop.hbase.ClusterMetrics initial,
org.apache.hadoop.hbase.ClusterMetrics current) |
void |
resumeRegionServer(org.apache.hadoop.hbase.ServerName serverName)
Resume the region server
|
void |
setClusterManager(ClusterManager clusterManager) |
void |
shutdown()
Shut down the HBase cluster
|
void |
startDataNode(org.apache.hadoop.hbase.ServerName serverName)
Starts a new datanode on the given hostname or if this is a mini/local cluster,
silently logs warning message.
|
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 |
startNameNode(org.apache.hadoop.hbase.ServerName serverName)
Starts a new namenode on the given hostname or if this is a mini/local cluster, silently logs
warning message.
|
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 |
startZkNode(String hostname,
int port)
Starts a new zookeeper node on the given hostname or if this is a mini/local cluster,
silently logs warning message.
|
void |
stopDataNode(org.apache.hadoop.hbase.ServerName serverName)
Stops the datanode if this is a distributed cluster, otherwise
silently logs warning message.
|
void |
stopMaster(org.apache.hadoop.hbase.ServerName serverName)
Stops the given master, by attempting a gradual stop.
|
void |
stopNameNode(org.apache.hadoop.hbase.ServerName serverName)
Stops the namenode if this is a distributed cluster, otherwise silently logs warning message.
|
void |
stopRegionServer(org.apache.hadoop.hbase.ServerName serverName)
Stops the given region server, by attempting a gradual stop.
|
void |
stopZkNode(org.apache.hadoop.hbase.ServerName serverName)
Stops the region zookeeper if this is a distributed cluster, otherwise
silently logs warning message.
|
void |
suspendRegionServer(org.apache.hadoop.hbase.ServerName serverName)
Suspend the region server
|
boolean |
waitForActiveAndReadyMaster(long timeout)
Blocks until there is an active master and that master has completed
initialization.
|
void |
waitForDataNodeToStart(org.apache.hadoop.hbase.ServerName serverName,
long timeout)
Wait for the specified datanode to join the cluster
|
void |
waitForDataNodeToStop(org.apache.hadoop.hbase.ServerName serverName,
long timeout)
Wait for the specified datanode to stop the thread / process.
|
void |
waitForMasterToStop(org.apache.hadoop.hbase.ServerName serverName,
long timeout)
Wait for the specified master to stop the thread / process.
|
void |
waitForNameNodeToStart(org.apache.hadoop.hbase.ServerName serverName,
long timeout)
Wait for the specified namenode to join the cluster
|
void |
waitForNameNodeToStop(org.apache.hadoop.hbase.ServerName serverName,
long timeout)
Wait for the specified namenode to stop
|
void |
waitForRegionServerToStop(org.apache.hadoop.hbase.ServerName serverName,
long timeout)
Wait for the specified region server to stop the thread / process.
|
private void |
waitForServiceToStart(ClusterManager.ServiceType service,
org.apache.hadoop.hbase.ServerName serverName,
long timeout) |
private void |
waitForServiceToStop(ClusterManager.ServiceType service,
org.apache.hadoop.hbase.ServerName serverName,
long timeout) |
void |
waitForZkNodeToStart(org.apache.hadoop.hbase.ServerName serverName,
long timeout)
Wait for the specified zookeeper node to join the cluster
|
void |
waitForZkNodeToStop(org.apache.hadoop.hbase.ServerName serverName,
long timeout)
Wait for the specified zookeeper node to stop the thread / process.
|
void |
waitUntilShutDown()
Wait for HBase Cluster to shut down.
|
getConf, getServerHoldingMeta, restoreInitialStatus, setConf, waitForActiveAndReadyMaster, waitForDatanodesRegistered, waitForNamenodeAvailable, waitForRegionServerToStart
private org.apache.hadoop.hbase.client.Admin admin
private final org.apache.hadoop.hbase.client.Connection connection
private ClusterManager clusterManager
private Set<org.apache.hadoop.hbase.ServerName> killedRegionServers
public DistributedHBaseCluster(org.apache.hadoop.conf.Configuration conf, ClusterManager clusterManager) throws IOException
IOException
public void setClusterManager(ClusterManager clusterManager)
public ClusterManager getClusterManager()
public org.apache.hadoop.hbase.ClusterMetrics getClusterMetrics() throws IOException
getClusterMetrics
in class HBaseCluster
IOException
HBaseCluster.getInitialClusterMetrics()
public org.apache.hadoop.hbase.ClusterMetrics getInitialClusterMetrics() throws IOException
HBaseCluster
getInitialClusterMetrics
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 org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface getAdminProtocol(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
getAdminProtocol
in class HBaseCluster
IOException
public org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface getClientProtocol(org.apache.hadoop.hbase.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(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
killRegionServer
in class HBaseCluster
IOException
- if something goes wrongpublic boolean isKilledRS(org.apache.hadoop.hbase.ServerName serverName)
HBaseCluster
isKilledRS
in class HBaseCluster
public void stopRegionServer(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
stopRegionServer
in class HBaseCluster
IOException
- if something goes wrongpublic void waitForRegionServerToStop(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException
HBaseCluster
waitForRegionServerToStop
in class HBaseCluster
IOException
- if something goes wrong or timeout occurspublic void suspendRegionServer(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
suspendRegionServer
in class HBaseCluster
serverName
- the hostname to suspend the regionserver onIOException
- if something goes wrongpublic void resumeRegionServer(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
resumeRegionServer
in class HBaseCluster
serverName
- the hostname to resume the regionserver onIOException
- if something goes wrongpublic void startZkNode(String hostname, int port) throws IOException
HBaseCluster
startZkNode
in class HBaseCluster
hostname
- the hostname to start the regionserver onIOException
- if something goes wrongpublic void killZkNode(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
killZkNode
in class HBaseCluster
IOException
- if something goes wrongpublic void stopZkNode(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
stopZkNode
in class HBaseCluster
IOException
- if something goes wrongpublic void waitForZkNodeToStart(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException
HBaseCluster
waitForZkNodeToStart
in class HBaseCluster
IOException
- if something goes wrong or timeout occurspublic void waitForZkNodeToStop(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException
HBaseCluster
waitForZkNodeToStop
in class HBaseCluster
IOException
- if something goes wrong or timeout occurspublic void startDataNode(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
startDataNode
in class HBaseCluster
IOException
- if something goes wrongpublic void killDataNode(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
killDataNode
in class HBaseCluster
IOException
- if something goes wrongpublic void stopDataNode(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
stopDataNode
in class HBaseCluster
IOException
- if something goes wrongpublic void waitForDataNodeToStart(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException
HBaseCluster
waitForDataNodeToStart
in class HBaseCluster
IOException
- if something goes wrong or timeout occurspublic void waitForDataNodeToStop(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException
HBaseCluster
waitForDataNodeToStop
in class HBaseCluster
IOException
- if something goes wrong or timeout occurspublic void startNameNode(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
startNameNode
in class HBaseCluster
IOException
- if something goes wrongpublic void killNameNode(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
killNameNode
in class HBaseCluster
IOException
- if something goes wrongpublic void stopNameNode(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
stopNameNode
in class HBaseCluster
IOException
- if something goes wrongpublic void waitForNameNodeToStart(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException
HBaseCluster
waitForNameNodeToStart
in class HBaseCluster
IOException
- if something goes wrong or timeout occurspublic void waitForNameNodeToStop(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException
HBaseCluster
waitForNameNodeToStop
in class HBaseCluster
IOException
- if something goes wrong or timeout occursprivate void waitForServiceToStop(ClusterManager.ServiceType service, org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException
IOException
private void waitForServiceToStart(ClusterManager.ServiceType service, org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException
IOException
public org.apache.hadoop.hbase.shaded.protobuf.generated.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(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
killMaster
in class HBaseCluster
IOException
- if something goes wrongpublic void stopMaster(org.apache.hadoop.hbase.ServerName serverName) throws IOException
HBaseCluster
stopMaster
in class HBaseCluster
IOException
- if something goes wrongpublic void waitForMasterToStop(org.apache.hadoop.hbase.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 org.apache.hadoop.hbase.ServerName getServerHoldingRegion(org.apache.hadoop.hbase.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 restoreClusterMetrics(org.apache.hadoop.hbase.ClusterMetrics initial) throws IOException
HBaseCluster
restoreClusterMetrics
in class HBaseCluster
IOException
protected boolean restoreMasters(org.apache.hadoop.hbase.ClusterMetrics initial, org.apache.hadoop.hbase.ClusterMetrics current)
protected boolean restoreRegionServers(org.apache.hadoop.hbase.ClusterMetrics initial, org.apache.hadoop.hbase.ClusterMetrics current)
protected boolean restoreAdmin() throws IOException
IOException
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.