Package org.apache.hadoop.hbase
Class HBaseCluster
java.lang.Object
org.apache.hadoop.hbase.HBaseCluster
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.conf.Configurable
- Direct Known Subclasses:
MiniHBaseCluster
@Public
@Deprecated
public abstract class HBaseCluster
extends Object
implements Closeable, org.apache.hadoop.conf.Configurable
Deprecated.
This class defines methods that can help with managing HBase clusters from unit tests and system
tests. There are 3 types of cluster deployments:
- MiniHBaseCluster: each server is run in the same JVM in separate threads, used by unit tests
- DistributedHBaseCluster: the cluster is pre-deployed, system and integration tests can interact with the cluster.
- ProcessBasedLocalHBaseCluster: each server is deployed locally but in separate JVMs.
HBaseCluster unifies the way tests interact with the cluster, so that the same test can be run against a mini-cluster during unit test execution, or a distributed cluster having tens/hundreds of nodes during execution of integration tests.
HBaseCluster exposes client-side public interfaces to tests, so that tests does not assume running in a particular mode. Not all the tests are suitable to be run on an actual cluster, and some tests will still need to mock stuff and introspect internal state. For those use cases from unit tests, or if more control is needed, you can use the subclasses directly. In that sense, this class does not abstract away every interface that MiniHBaseCluster or DistributedHBaseCluster provide.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.hadoop.conf.ConfigurationDeprecated.protected ClusterMetricsDeprecated.the status of the cluster before we begin(package private) static final org.slf4j.LoggerDeprecated. -
Constructor Summary
ConstructorsConstructorDescriptionHBaseCluster(org.apache.hadoop.conf.Configuration conf) Deprecated.Construct an HBaseCluster -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclose()Deprecated.Closes all the resources held open for this cluster.abstract ClusterMetricsDeprecated.Returns a ClusterMetrics for this HBase cluster.org.apache.hadoop.conf.ConfigurationgetConf()Deprecated.Deprecated.Returns a ClusterStatus for this HBase cluster as observed at the starting of the HBaseClusterDeprecated.Get the ServerName of region server serving the first hbase:meta regionabstract ServerNamegetServerHoldingRegion(TableName tn, byte[] regionName) Deprecated.Get the ServerName of region server serving the specified regionbooleanDeprecated.abstract booleanisKilledRS(ServerName serverName) Deprecated.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.abstract voidkillDataNode(ServerName serverName) Deprecated.Kills the datanode process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.abstract voidkillMaster(ServerName serverName) Deprecated.Kills the master process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.abstract voidkillNameNode(ServerName serverName) Deprecated.Kills the namenode process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.abstract voidkillRegionServer(ServerName serverName) Deprecated.Kills the region server process if this is a distributed cluster, otherwise this causes the region server to exit doing basic clean up only.abstract voidkillZkNode(ServerName serverName) Deprecated.Kills the zookeeper node process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.booleanrestoreClusterMetrics(ClusterMetrics desiredStatus) Deprecated.Restores the cluster to given state if this is a real cluster, otherwise does nothing.booleanDeprecated.Restores the cluster to it's initial state if this is a real cluster, otherwise does nothing.abstract voidresumeRegionServer(ServerName serverName) Deprecated.Resume the region servervoidsetConf(org.apache.hadoop.conf.Configuration conf) Deprecated.abstract voidshutdown()Deprecated.Shut down the HBase clusterabstract voidstartDataNode(ServerName serverName) Deprecated.Starts a new datanode on the given hostname or if this is a mini/local cluster, silently logs warning message.abstract voidstartMaster(String hostname, int port) Deprecated.Starts a new master on the given hostname or if this is a mini/local cluster, starts a master locally.abstract voidstartNameNode(ServerName serverName) Deprecated.Starts a new namenode on the given hostname or if this is a mini/local cluster, silently logs warning message.abstract voidstartRegionServer(String hostname, int port) Deprecated.Starts a new region server on the given hostname or if this is a mini/local cluster, starts a region server locally.abstract voidstartZkNode(String hostname, int port) Deprecated.Starts a new zookeeper node on the given hostname or if this is a mini/local cluster, silently logs warning message.abstract voidstopDataNode(ServerName serverName) Deprecated.Stops the datanode if this is a distributed cluster, otherwise silently logs warning message.abstract voidstopMaster(ServerName serverName) Deprecated.Stops the given master, by attempting a gradual stop.abstract voidstopNameNode(ServerName serverName) Deprecated.Stops the namenode if this is a distributed cluster, otherwise silently logs warning message.abstract voidstopRegionServer(ServerName serverName) Deprecated.Stops the given region server, by attempting a gradual stop.abstract voidstopZkNode(ServerName serverName) Deprecated.Stops the region zookeeper if this is a distributed cluster, otherwise silently logs warning message.abstract voidsuspendRegionServer(ServerName serverName) Deprecated.Suspend the region serverbooleanDeprecated.Blocks until there is an active master and that master has completed initialization.abstract booleanwaitForActiveAndReadyMaster(long timeout) Deprecated.Blocks until there is an active master and that master has completed initialization.voidwaitForDatanodesRegistered(int nbDN) Deprecated.abstract voidwaitForDataNodeToStart(ServerName serverName, long timeout) Deprecated.Wait for the specified datanode to join the clusterabstract voidwaitForDataNodeToStop(ServerName serverName, long timeout) Deprecated.Wait for the specified datanode to stop the thread / process.abstract voidwaitForMasterToStop(ServerName serverName, long timeout) Deprecated.Wait for the specified master to stop the thread / process.voidDeprecated.Wait for the namenode.abstract voidwaitForNameNodeToStart(ServerName serverName, long timeout) Deprecated.Wait for the specified namenode to join the clusterabstract voidwaitForNameNodeToStop(ServerName serverName, long timeout) Deprecated.Wait for the specified namenode to stopvoidwaitForRegionServerToStart(String hostname, int port, long timeout) Deprecated.Wait for the specified region server to join the clusterabstract voidwaitForRegionServerToStop(ServerName serverName, long timeout) Deprecated.Wait for the specified region server to stop the thread / process.abstract voidwaitForZkNodeToStart(ServerName serverName, long timeout) Deprecated.Wait for the specified zookeeper node to join the clusterabstract voidwaitForZkNodeToStop(ServerName serverName, long timeout) Deprecated.Wait for the specified zookeeper node to stop the thread / process.abstract voidDeprecated.Wait for HBase Cluster to shut down.
-
Field Details
-
LOG
Deprecated. -
conf
Deprecated. -
initialClusterStatus
Deprecated.the status of the cluster before we begin
-
-
Constructor Details
-
HBaseCluster
Deprecated.Construct an HBaseCluster- Parameters:
conf- Configuration to be used for cluster
-
-
Method Details
-
setConf
Deprecated.- Specified by:
setConfin interfaceorg.apache.hadoop.conf.Configurable
-
getConf
Deprecated.- Specified by:
getConfin interfaceorg.apache.hadoop.conf.Configurable
-
getClusterMetrics
Deprecated.Returns a ClusterMetrics for this HBase cluster.- Throws:
IOException- See Also:
-
getInitialClusterMetrics
Deprecated.Returns a ClusterStatus for this HBase cluster as observed at the starting of the HBaseCluster- Throws:
IOException
-
startRegionServer
Deprecated.Starts a new region server on the given hostname or if this is a mini/local cluster, starts a region server locally.- Parameters:
hostname- the hostname to start the regionserver on- Throws:
IOException- if something goes wrong
-
killRegionServer
Deprecated.Kills the region server process if this is a distributed cluster, otherwise this causes the region server to exit doing basic clean up only.- Throws:
IOException- if something goes wrong
-
isKilledRS
Deprecated.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. A concrete example of such case is - killing servers and waiting for all regions of a particular table to be assigned. We can check for server column in META table and that its value is not one of the killed servers. -
stopRegionServer
Deprecated.Stops the given region server, by attempting a gradual stop.- Throws:
IOException- if something goes wrong
-
waitForRegionServerToStart
Deprecated.Wait for the specified region server to join the cluster- Throws:
IOException- if something goes wrong or timeout occurs
-
waitForRegionServerToStop
public abstract void waitForRegionServerToStop(ServerName serverName, long timeout) throws IOException Deprecated.Wait for the specified region server to stop the thread / process.- Throws:
IOException- if something goes wrong or timeout occurs
-
suspendRegionServer
Deprecated.Suspend the region server- Parameters:
serverName- the hostname to suspend the regionserver on- Throws:
IOException- if something goes wrong
-
resumeRegionServer
Deprecated.Resume the region server- Parameters:
serverName- the hostname to resume the regionserver on- Throws:
IOException- if something goes wrong
-
startZkNode
Deprecated.Starts a new zookeeper node on the given hostname or if this is a mini/local cluster, silently logs warning message.- Parameters:
hostname- the hostname to start the regionserver on- Throws:
IOException- if something goes wrong
-
killZkNode
Deprecated.Kills the zookeeper node process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Throws:
IOException- if something goes wrong
-
stopZkNode
Deprecated.Stops the region zookeeper if this is a distributed cluster, otherwise silently logs warning message.- Throws:
IOException- if something goes wrong
-
waitForZkNodeToStart
Deprecated.Wait for the specified zookeeper node to join the cluster- Throws:
IOException- if something goes wrong or timeout occurs
-
waitForZkNodeToStop
Deprecated.Wait for the specified zookeeper node to stop the thread / process.- Throws:
IOException- if something goes wrong or timeout occurs
-
startDataNode
Deprecated.Starts a new datanode on the given hostname or if this is a mini/local cluster, silently logs warning message.- Throws:
IOException- if something goes wrong
-
killDataNode
Deprecated.Kills the datanode process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Throws:
IOException- if something goes wrong
-
stopDataNode
Deprecated.Stops the datanode if this is a distributed cluster, otherwise silently logs warning message.- Throws:
IOException- if something goes wrong
-
waitForDataNodeToStart
Deprecated.Wait for the specified datanode to join the cluster- Throws:
IOException- if something goes wrong or timeout occurs
-
waitForDataNodeToStop
Deprecated.Wait for the specified datanode to stop the thread / process.- Throws:
IOException- if something goes wrong or timeout occurs
-
startNameNode
Deprecated.Starts a new namenode on the given hostname or if this is a mini/local cluster, silently logs warning message.- Throws:
IOException- if something goes wrong
-
killNameNode
Deprecated.Kills the namenode process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Throws:
IOException- if something goes wrong
-
stopNameNode
Deprecated.Stops the namenode if this is a distributed cluster, otherwise silently logs warning message.- Throws:
IOException- if something goes wrong
-
waitForNameNodeToStart
Deprecated.Wait for the specified namenode to join the cluster- Throws:
IOException- if something goes wrong or timeout occurs
-
waitForNameNodeToStop
Deprecated.Wait for the specified namenode to stop- Throws:
IOException- if something goes wrong or timeout occurs
-
startMaster
Deprecated.Starts a new master on the given hostname or if this is a mini/local cluster, starts a master locally.- Parameters:
hostname- the hostname to start the master on- Throws:
IOException- if something goes wrong
-
killMaster
Deprecated.Kills the master process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Throws:
IOException- if something goes wrong
-
stopMaster
Deprecated.Stops the given master, by attempting a gradual stop.- Throws:
IOException- if something goes wrong
-
waitForMasterToStop
Deprecated.Wait for the specified master to stop the thread / process.- Throws:
IOException- if something goes wrong or timeout occurs
-
waitForActiveAndReadyMaster
Deprecated.Blocks until there is an active master and that master has completed initialization.- Returns:
- true if an active master becomes available. false if there are no masters left.
- Throws:
IOException- if something goes wrong or timeout occurs
-
waitForActiveAndReadyMaster
Deprecated.Blocks until there is an active master and that master has completed initialization.- Parameters:
timeout- the timeout limit in ms- Returns:
- true if an active master becomes available. false if there are no masters left.
- Throws:
IOException
-
waitUntilShutDown
Deprecated.Wait for HBase Cluster to shut down.- Throws:
IOException
-
shutdown
Deprecated.Shut down the HBase cluster- Throws:
IOException
-
restoreInitialStatus
Deprecated.Restores the cluster to it's initial state if this is a real cluster, otherwise does nothing. This is a best effort restore. If the servers are not reachable, or insufficient permissions, etc. restoration might be partial.- Returns:
- whether restoration is complete
- Throws:
IOException
-
restoreClusterMetrics
Deprecated.Restores the cluster to given state if this is a real cluster, otherwise does nothing. This is a best effort restore. If the servers are not reachable, or insufficient permissions, etc. restoration might be partial.- Returns:
- whether restoration is complete
- Throws:
IOException
-
getServerHoldingMeta
Deprecated.Get the ServerName of region server serving the first hbase:meta region- Throws:
IOException
-
getServerHoldingRegion
public abstract ServerName getServerHoldingRegion(TableName tn, byte[] regionName) throws IOException Deprecated.Get the ServerName of region server serving the specified region- Parameters:
regionName- Name of the region in bytestn- Table name that has the region.- Returns:
- ServerName that hosts the region or null
- Throws:
IOException
-
isDistributedCluster
Deprecated.- Returns:
- whether we are interacting with a distributed cluster as opposed to an in-process mini/local cluster.
-
close
Deprecated.Closes all the resources held open for this cluster. Note that this call does not shutdown the cluster.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- See Also:
-
waitForNamenodeAvailable
Deprecated.Wait for the namenode.- Throws:
InterruptedException
-
waitForDatanodesRegistered
Deprecated.- Throws:
Exception
-
TestingHBaseClusterinstead.