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
Modifier and TypeFieldDescriptionprotected org.apache.hadoop.conf.Configuration
Deprecated.protected ClusterMetrics
Deprecated.the status of the cluster before we begin(package private) static final org.slf4j.Logger
Deprecated. -
Constructor Summary
ConstructorDescriptionHBaseCluster
(org.apache.hadoop.conf.Configuration conf) Deprecated.Construct an HBaseCluster -
Method Summary
Modifier and TypeMethodDescriptionabstract void
close()
Deprecated.Closes all the resources held open for this cluster.abstract ClusterMetrics
Deprecated.Returns a ClusterMetrics for this HBase cluster.org.apache.hadoop.conf.Configuration
getConf()
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 ServerName
getServerHoldingRegion
(TableName tn, byte[] regionName) Deprecated.Get the ServerName of region server serving the specified regionboolean
Deprecated.abstract boolean
isKilledRS
(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 void
killDataNode
(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 void
killMaster
(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 void
killNameNode
(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 void
killRegionServer
(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 void
killZkNode
(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.boolean
restoreClusterMetrics
(ClusterMetrics desiredStatus) Deprecated.Restores the cluster to given state if this is a real cluster, otherwise does nothing.boolean
Deprecated.Restores the cluster to it's initial state if this is a real cluster, otherwise does nothing.abstract void
resumeRegionServer
(ServerName serverName) Deprecated.Resume the region servervoid
setConf
(org.apache.hadoop.conf.Configuration conf) Deprecated.abstract void
shutdown()
Deprecated.Shut down the HBase clusterabstract void
startDataNode
(ServerName serverName) Deprecated.Starts a new datanode on the given hostname or if this is a mini/local cluster, silently logs warning message.abstract void
startMaster
(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 void
startNameNode
(ServerName serverName) Deprecated.Starts a new namenode on the given hostname or if this is a mini/local cluster, silently logs warning message.abstract void
startRegionServer
(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 void
startZkNode
(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 void
stopDataNode
(ServerName serverName) Deprecated.Stops the datanode if this is a distributed cluster, otherwise silently logs warning message.abstract void
stopMaster
(ServerName serverName) Deprecated.Stops the given master, by attempting a gradual stop.abstract void
stopNameNode
(ServerName serverName) Deprecated.Stops the namenode if this is a distributed cluster, otherwise silently logs warning message.abstract void
stopRegionServer
(ServerName serverName) Deprecated.Stops the given region server, by attempting a gradual stop.abstract void
stopZkNode
(ServerName serverName) Deprecated.Stops the region zookeeper if this is a distributed cluster, otherwise silently logs warning message.abstract void
suspendRegionServer
(ServerName serverName) Deprecated.Suspend the region serverboolean
Deprecated.Blocks until there is an active master and that master has completed initialization.abstract boolean
waitForActiveAndReadyMaster
(long timeout) Deprecated.Blocks until there is an active master and that master has completed initialization.void
waitForDatanodesRegistered
(int nbDN) Deprecated.abstract void
waitForDataNodeToStart
(ServerName serverName, long timeout) Deprecated.Wait for the specified datanode to join the clusterabstract void
waitForDataNodeToStop
(ServerName serverName, long timeout) Deprecated.Wait for the specified datanode to stop the thread / process.abstract void
waitForMasterToStop
(ServerName serverName, long timeout) Deprecated.Wait for the specified master to stop the thread / process.void
Deprecated.Wait for the namenode.abstract void
waitForNameNodeToStart
(ServerName serverName, long timeout) Deprecated.Wait for the specified namenode to join the clusterabstract void
waitForNameNodeToStop
(ServerName serverName, long timeout) Deprecated.Wait for the specified namenode to stopvoid
waitForRegionServerToStart
(String hostname, int port, long timeout) Deprecated.Wait for the specified region server to join the clusterabstract void
waitForRegionServerToStop
(ServerName serverName, long timeout) Deprecated.Wait for the specified region server to stop the thread / process.abstract void
waitForZkNodeToStart
(ServerName serverName, long timeout) Deprecated.Wait for the specified zookeeper node to join the clusterabstract void
waitForZkNodeToStop
(ServerName serverName, long timeout) Deprecated.Wait for the specified zookeeper node to stop the thread / process.abstract void
Deprecated.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:
setConf
in interfaceorg.apache.hadoop.conf.Configurable
-
getConf
Deprecated.- Specified by:
getConf
in 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
- See Also:
-
waitForNamenodeAvailable
Deprecated.Wait for the namenode.- Throws:
InterruptedException
-
waitForDatanodesRegistered
Deprecated.- Throws:
Exception
-
TestingHBaseCluster
instead.