Package org.apache.hadoop.hbase
Class MiniHBaseCluster
java.lang.Object
org.apache.hadoop.hbase.HBaseCluster
org.apache.hadoop.hbase.MiniHBaseCluster
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.conf.Configurable
Deprecated.
This class creates a single process HBase cluster. each server. The master uses the 'default'
FileSystem. The RegionServers, if we are running on DistributedFilesystem, create a FileSystem
instance each and will close down their instance on the way out.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.Subclass so can get at protected methods (none at moment).(package private) static classDeprecated.Alternate shutdown hook. -
Field Summary
FieldsModifier and TypeFieldDescriptionDeprecated.private static intDeprecated.private static final org.slf4j.LoggerDeprecated.Fields inherited from class org.apache.hadoop.hbase.HBaseCluster
conf, initialClusterStatus -
Constructor Summary
ConstructorsConstructorDescriptionMiniHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numRegionServers) Deprecated.Start a MiniHBaseCluster.MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numMasters, int numRegionServers) Deprecated.Start a MiniHBaseCluster.MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numMasters, int numAlwaysStandByMasters, int numRegionServers, List<Integer> rsPorts, Class<? extends HMaster> masterClass, Class<? extends MiniHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) Deprecated.MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numMasters, int numRegionServers, Class<? extends HMaster> masterClass, Class<? extends MiniHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) Deprecated.Start a MiniHBaseCluster. -
Method Summary
Modifier and TypeMethodDescriptionabortMaster(int serverNumber) Deprecated.Cause a master to exit without shutting down entire cluster.abortRegionServer(int serverNumber) Deprecated.Cause a region server to exit doing basic clean up only on its way out.voidclose()Deprecated.Closes all the resources held open for this cluster.voidcompact(boolean major) Deprecated.Call flushCache on all regions on all participating regionservers.voidDeprecated.Call flushCache on all regions of the specified table.longDeprecated.Counts the total numbers of regions being served by the currently online region servers by asking each how many regions they have.private voidexecuteFlush(HRegion region) Deprecated.findRegionsForTable(TableName tableName) Deprecated.voidDeprecated.Call flushCache on all regions on all participating regionservers.voidflushcache(TableName tableName) Deprecated.Call flushCache on all regions of the specified table.Deprecated.Returns a ClusterMetrics for this HBase cluster.org.apache.hadoop.conf.ConfigurationDeprecated.Deprecated.Returns List of live master threads (skips the aborted and the killed)Deprecated.Returns List of live region server threads (skips the aborted and the killed)Deprecated.Returns the current active master, if available.getMaster(int serverNumber) Deprecated.Returns the master at the specified index, if available.protected intgetMasterIndex(ServerName serverName) Deprecated.Deprecated.Returns the current active master thread, if available.Deprecated.Returns List of master threads.intDeprecated.Returns Number of live region servers in the cluster currently.getRegions(byte[] tableName) Deprecated.getRegions(TableName tableName) Deprecated.getRegionServer(int serverNumber) Deprecated.Grab a numbered region server of your choice.getRegionServer(ServerName serverName) Deprecated.protected intgetRegionServerIndex(ServerName serverName) Deprecated.Deprecated.getServerHoldingRegion(TableName tn, byte[] regionName) Deprecated.Get the ServerName of region server serving the specified regionintgetServerWith(byte[] regionName) Deprecated.Get the location of the specified regionintDeprecated.private voidinit(int nMasterNodes, int numAlwaysStandByMasters, int nRegionNodes, List<Integer> rsPorts, Class<? extends HMaster> masterClass, Class<? extends MiniHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) Deprecated.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.voidjoin()Deprecated.Wait for Mini HBase Cluster to shut down.voidkillAll()Deprecated.Do a simulated kill all masters and regionservers.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.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.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.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.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.resumeRegionServer(int serverNumber) Deprecated.Resume the specified region servervoidresumeRegionServer(ServerName serverName) Deprecated.Resume the region servervoidshutdown()Deprecated.Shut down the mini HBase clustervoidstartDataNode(ServerName serverName) Deprecated.Starts a new datanode on the given hostname or if this is a mini/local cluster, silently logs warning message.Deprecated.Starts a master thread runningvoidstartMaster(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.voidstartNameNode(ServerName serverName) Deprecated.Starts a new namenode on the given hostname or if this is a mini/local cluster, silently logs warning message.Deprecated.Starts a region server thread runningvoidstartRegionServer(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.startRegionServer(org.apache.hadoop.conf.Configuration configuration) Deprecated.startRegionServerAndWait(long timeout) Deprecated.Starts a region server thread and waits until its processed by master.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.voidstopDataNode(ServerName serverName) Deprecated.Stops the datanode if this is a distributed cluster, otherwise silently logs warning message.stopMaster(int serverNumber) Deprecated.Shut down the specified master cleanlystopMaster(int serverNumber, boolean shutdownFS) Deprecated.Shut down the specified master cleanlyvoidstopMaster(ServerName serverName) Deprecated.Stops the given master, by attempting a gradual stop.voidstopNameNode(ServerName serverName) Deprecated.Stops the namenode if this is a distributed cluster, otherwise silently logs warning message.stopRegionServer(int serverNumber) Deprecated.Shut down the specified region server cleanlystopRegionServer(int serverNumber, boolean shutdownFS) Deprecated.Shut down the specified region server cleanlyvoidstopRegionServer(ServerName serverName) Deprecated.Stops the given region server, by attempting a gradual stop.voidstopZkNode(ServerName serverName) Deprecated.Stops the region zookeeper if this is a distributed cluster, otherwise silently logs warning message.suspendRegionServer(int serverNumber) Deprecated.Suspend the specified region servervoidsuspendRegionServer(ServerName serverName) Deprecated.Suspend the region serverbooleanwaitForActiveAndReadyMaster(long timeout) Deprecated.Blocks until there is an active master and that master has completed initialization.voidwaitForDataNodeToStart(ServerName serverName, long timeout) Deprecated.Wait for the specified datanode to join the clustervoidwaitForDataNodeToStop(ServerName serverName, long timeout) Deprecated.Wait for the specified datanode to stop the thread / process.voidwaitForMasterToStop(ServerName serverName, long timeout) Deprecated.Wait for the specified master to stop the thread / process.voidwaitForNameNodeToStart(ServerName serverName, long timeout) Deprecated.Wait for the specified namenode to join the clustervoidwaitForNameNodeToStop(ServerName serverName, long timeout) Deprecated.Wait for the specified namenode to stopvoidwaitForRegionServerToStop(ServerName serverName, long timeout) Deprecated.Wait for the specified region server to stop the thread / process.voidwaitForZkNodeToStart(ServerName serverName, long timeout) Deprecated.Wait for the specified zookeeper node to join the clustervoidwaitForZkNodeToStop(ServerName serverName, long timeout) Deprecated.Wait for the specified zookeeper node to stop the thread / process.waitOnMaster(int serverNumber) Deprecated.Wait for the specified master to stop.waitOnRegionServer(int serverNumber) Deprecated.Wait for the specified region server to stop.voidDeprecated.Wait for HBase Cluster to shut down.Methods inherited from class org.apache.hadoop.hbase.HBaseCluster
getConf, getInitialClusterMetrics, getServerHoldingMeta, isDistributedCluster, restoreClusterMetrics, restoreInitialStatus, setConf, waitForActiveAndReadyMaster, waitForDatanodesRegistered, waitForNamenodeAvailable, waitForRegionServerToStart
-
Field Details
-
LOG
Deprecated. -
hbaseCluster
Deprecated. -
index
Deprecated.
-
-
Constructor Details
-
MiniHBaseCluster
public MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numRegionServers) throws IOException, InterruptedException Deprecated.Start a MiniHBaseCluster.- Parameters:
conf- Configuration to be used for clusternumRegionServers- initial number of region servers to start.- Throws:
IOExceptionInterruptedException
-
MiniHBaseCluster
public MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numMasters, int numRegionServers) throws IOException, InterruptedException Deprecated.Start a MiniHBaseCluster.- Parameters:
conf- Configuration to be used for clusternumMasters- initial number of masters to start.numRegionServers- initial number of region servers to start.- Throws:
IOExceptionInterruptedException
-
MiniHBaseCluster
public MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numMasters, int numRegionServers, Class<? extends HMaster> masterClass, Class<? extends MiniHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) throws IOException, InterruptedException Deprecated.Start a MiniHBaseCluster.- Parameters:
conf- Configuration to be used for clusternumMasters- initial number of masters to start.numRegionServers- initial number of region servers to start.- Throws:
IOExceptionInterruptedException
-
MiniHBaseCluster
public MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numMasters, int numAlwaysStandByMasters, int numRegionServers, List<Integer> rsPorts, Class<? extends HMaster> masterClass, Class<? extends MiniHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) throws IOException, InterruptedException Deprecated.- Parameters:
rsPorts- Ports that RegionServer should use; pass ports if you want to test cluster restart where for sure the regionservers come up on same address+port (but just with different startcode); by default mini hbase clusters choose new arbitrary ports on each cluster start.- Throws:
IOExceptionInterruptedException
-
-
Method Details
-
getConfiguration
Deprecated. -
init
private void init(int nMasterNodes, int numAlwaysStandByMasters, int nRegionNodes, List<Integer> rsPorts, Class<? extends HMaster> masterClass, Class<? extends MiniHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) throws IOException, InterruptedException Deprecated.- Throws:
IOExceptionInterruptedException
-
startRegionServer
Deprecated.Description copied from class:HBaseClusterStarts a new region server on the given hostname or if this is a mini/local cluster, starts a region server locally.- Specified by:
startRegionServerin classHBaseCluster- Parameters:
hostname- the hostname to start the regionserver on- Throws:
IOException- if something goes wrong
-
killRegionServer
Deprecated.Description copied from class:HBaseClusterKills the region server process if this is a distributed cluster, otherwise this causes the region server to exit doing basic clean up only.- Specified by:
killRegionServerin classHBaseCluster- Throws:
IOException- if something goes wrong
-
isKilledRS
Deprecated.Description copied from class:HBaseClusterKeeping 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.- Specified by:
isKilledRSin classHBaseCluster
-
stopRegionServer
Deprecated.Description copied from class:HBaseClusterStops the given region server, by attempting a gradual stop.- Specified by:
stopRegionServerin classHBaseCluster- Throws:
IOException- if something goes wrong
-
suspendRegionServer
Deprecated.Description copied from class:HBaseClusterSuspend the region server- Specified by:
suspendRegionServerin classHBaseCluster- Parameters:
serverName- the hostname to suspend the regionserver on- Throws:
IOException- if something goes wrong
-
resumeRegionServer
Deprecated.Description copied from class:HBaseClusterResume the region server- Specified by:
resumeRegionServerin classHBaseCluster- Parameters:
serverName- the hostname to resume the regionserver on- Throws:
IOException- if something goes wrong
-
waitForRegionServerToStop
Deprecated.Description copied from class:HBaseClusterWait for the specified region server to stop the thread / process.- Specified by:
waitForRegionServerToStopin classHBaseCluster- Throws:
IOException- if something goes wrong or timeout occurs
-
startZkNode
Deprecated.Description copied from class:HBaseClusterStarts a new zookeeper node on the given hostname or if this is a mini/local cluster, silently logs warning message.- Specified by:
startZkNodein classHBaseCluster- Parameters:
hostname- the hostname to start the regionserver on- Throws:
IOException- if something goes wrong
-
killZkNode
Deprecated.Description copied from class:HBaseClusterKills the zookeeper node process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Specified by:
killZkNodein classHBaseCluster- Throws:
IOException- if something goes wrong
-
stopZkNode
Deprecated.Description copied from class:HBaseClusterStops the region zookeeper if this is a distributed cluster, otherwise silently logs warning message.- Specified by:
stopZkNodein classHBaseCluster- Throws:
IOException- if something goes wrong
-
waitForZkNodeToStart
Deprecated.Description copied from class:HBaseClusterWait for the specified zookeeper node to join the cluster- Specified by:
waitForZkNodeToStartin classHBaseCluster- Throws:
IOException- if something goes wrong or timeout occurs
-
waitForZkNodeToStop
Deprecated.Description copied from class:HBaseClusterWait for the specified zookeeper node to stop the thread / process.- Specified by:
waitForZkNodeToStopin classHBaseCluster- Throws:
IOException- if something goes wrong or timeout occurs
-
startDataNode
Deprecated.Description copied from class:HBaseClusterStarts a new datanode on the given hostname or if this is a mini/local cluster, silently logs warning message.- Specified by:
startDataNodein classHBaseCluster- Throws:
IOException- if something goes wrong
-
killDataNode
Deprecated.Description copied from class:HBaseClusterKills the datanode process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Specified by:
killDataNodein classHBaseCluster- Throws:
IOException- if something goes wrong
-
stopDataNode
Deprecated.Description copied from class:HBaseClusterStops the datanode if this is a distributed cluster, otherwise silently logs warning message.- Specified by:
stopDataNodein classHBaseCluster- Throws:
IOException- if something goes wrong
-
waitForDataNodeToStart
Deprecated.Description copied from class:HBaseClusterWait for the specified datanode to join the cluster- Specified by:
waitForDataNodeToStartin classHBaseCluster- Throws:
IOException- if something goes wrong or timeout occurs
-
waitForDataNodeToStop
Deprecated.Description copied from class:HBaseClusterWait for the specified datanode to stop the thread / process.- Specified by:
waitForDataNodeToStopin classHBaseCluster- Throws:
IOException- if something goes wrong or timeout occurs
-
startNameNode
Deprecated.Description copied from class:HBaseClusterStarts a new namenode on the given hostname or if this is a mini/local cluster, silently logs warning message.- Specified by:
startNameNodein classHBaseCluster- Throws:
IOException- if something goes wrong
-
killNameNode
Deprecated.Description copied from class:HBaseClusterKills the namenode process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Specified by:
killNameNodein classHBaseCluster- Throws:
IOException- if something goes wrong
-
stopNameNode
Deprecated.Description copied from class:HBaseClusterStops the namenode if this is a distributed cluster, otherwise silently logs warning message.- Specified by:
stopNameNodein classHBaseCluster- Throws:
IOException- if something goes wrong
-
waitForNameNodeToStart
Deprecated.Description copied from class:HBaseClusterWait for the specified namenode to join the cluster- Specified by:
waitForNameNodeToStartin classHBaseCluster- Throws:
IOException- if something goes wrong or timeout occurs
-
waitForNameNodeToStop
Deprecated.Description copied from class:HBaseClusterWait for the specified namenode to stop- Specified by:
waitForNameNodeToStopin classHBaseCluster- Throws:
IOException- if something goes wrong or timeout occurs
-
startMaster
Deprecated.Description copied from class:HBaseClusterStarts a new master on the given hostname or if this is a mini/local cluster, starts a master locally.- Specified by:
startMasterin classHBaseCluster- Parameters:
hostname- the hostname to start the master on- Throws:
IOException- if something goes wrong
-
killMaster
Deprecated.Description copied from class:HBaseClusterKills the master process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Specified by:
killMasterin classHBaseCluster- Throws:
IOException- if something goes wrong
-
stopMaster
Deprecated.Description copied from class:HBaseClusterStops the given master, by attempting a gradual stop.- Specified by:
stopMasterin classHBaseCluster- Throws:
IOException- if something goes wrong
-
waitForMasterToStop
Deprecated.Description copied from class:HBaseClusterWait for the specified master to stop the thread / process.- Specified by:
waitForMasterToStopin classHBaseCluster- Throws:
IOException- if something goes wrong or timeout occurs
-
startRegionServer
Deprecated.Starts a region server thread running- Returns:
- New RegionServerThread
- Throws:
IOException
-
startRegionServer
private JVMClusterUtil.RegionServerThread startRegionServer(org.apache.hadoop.conf.Configuration configuration) throws IOException Deprecated.- Throws:
IOException
-
startRegionServerAndWait
Deprecated.Starts a region server thread and waits until its processed by master. Throws an exception when it can't start a region server or when the region server is not processed by master within the timeout.- Returns:
- New RegionServerThread
- Throws:
IOException
-
abortRegionServer
Deprecated.Cause a region server to exit doing basic clean up only on its way out.- Parameters:
serverNumber- Used as index into a list.
-
stopRegionServer
Deprecated.Shut down the specified region server cleanly- Parameters:
serverNumber- Used as index into a list.- Returns:
- the region server that was stopped
-
stopRegionServer
Deprecated.Shut down the specified region server cleanly- Parameters:
serverNumber- Used as index into a list.shutdownFS- True is we are to shutdown the filesystem as part of this regionserver's shutdown. Usually we do but you do not want to do this if you are running multiple regionservers in a test and you shut down one before end of the test.- Returns:
- the region server that was stopped
-
suspendRegionServer
Deprecated.Suspend the specified region server- Parameters:
serverNumber- Used as index into a list.
-
resumeRegionServer
Deprecated.Resume the specified region server- Parameters:
serverNumber- Used as index into a list.
-
waitOnRegionServer
Deprecated.Wait for the specified region server to stop. Removes this thread from list of running threads.- Returns:
- Name of region server that just went down.
-
startMaster
Deprecated.Starts a master thread running- Returns:
- New RegionServerThread
- Throws:
IOException
-
getMaster
Deprecated.Returns the current active master, if available.- Returns:
- the active HMaster, null if none is active.
-
getMasterThread
Deprecated.Returns the current active master thread, if available.- Returns:
- the active MasterThread, null if none is active.
-
getMaster
Deprecated.Returns the master at the specified index, if available.- Returns:
- the active HMaster, null if none is active.
-
abortMaster
Deprecated.Cause a master to exit without shutting down entire cluster.- Parameters:
serverNumber- Used as index into a list.
-
stopMaster
Deprecated.Shut down the specified master cleanly- Parameters:
serverNumber- Used as index into a list.- Returns:
- the region server that was stopped
-
stopMaster
Deprecated.Shut down the specified master cleanly- Parameters:
serverNumber- Used as index into a list.shutdownFS- True is we are to shutdown the filesystem as part of this master's shutdown. Usually we do but you do not want to do this if you are running multiple master in a test and you shut down one before end of the test.- Returns:
- the master that was stopped
-
waitOnMaster
Deprecated.Wait for the specified master to stop. Removes this thread from list of running threads.- Returns:
- Name of master that just went down.
-
waitForActiveAndReadyMaster
Deprecated.Blocks until there is an active master and that master has completed initialization.- Specified by:
waitForActiveAndReadyMasterin classHBaseCluster- Parameters:
timeout- the timeout limit in ms- Returns:
- true if an active master becomes available. false if there are no masters left.
- Throws:
IOException
-
getMasterThreads
Deprecated.Returns List of master threads. -
getLiveMasterThreads
Deprecated.Returns List of live master threads (skips the aborted and the killed) -
join
Deprecated.Wait for Mini HBase Cluster to shut down. -
shutdown
Deprecated.Shut down the mini HBase cluster- Specified by:
shutdownin classHBaseCluster- Throws:
IOException
-
close
Deprecated.Description copied from class:HBaseClusterCloses 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- Specified by:
closein classHBaseCluster- Throws:
IOException- See Also:
-
getClusterMetrics
Deprecated.Description copied from class:HBaseClusterReturns a ClusterMetrics for this HBase cluster.- Specified by:
getClusterMetricsin classHBaseCluster- Throws:
IOException- See Also:
-
executeFlush
Deprecated.- Throws:
IOException
-
flushcache
Deprecated.Call flushCache on all regions on all participating regionservers.- Throws:
IOException
-
flushcache
Deprecated.Call flushCache on all regions of the specified table.- Throws:
IOException
-
compact
Deprecated.Call flushCache on all regions on all participating regionservers.- Throws:
IOException
-
compact
Deprecated.Call flushCache on all regions of the specified table.- Throws:
IOException
-
getNumLiveRegionServers
Deprecated.Returns Number of live region servers in the cluster currently. -
getRegionServerThreads
Deprecated.- Returns:
- List of region server threads. Does not return the master even though it is also a region server.
-
getLiveRegionServerThreads
Deprecated.Returns List of live region server threads (skips the aborted and the killed) -
getRegionServer
Deprecated.Grab a numbered region server of your choice.- Returns:
- region server
-
getRegionServer
Deprecated. -
getRegions
Deprecated. -
getRegions
Deprecated. -
getServerWithMeta
Deprecated.- Returns:
- Index into List of
getRegionServerThreads()of HRS carrying regionName. Returns -1 if none found.
-
getServerWith
Deprecated.Get the location of the specified region- Parameters:
regionName- Name of the region in bytes- Returns:
- Index into List of
getRegionServerThreads()of HRS carrying hbase:meta. Returns -1 if none found.
-
getServerHoldingRegion
Deprecated.Description copied from class:HBaseClusterGet the ServerName of region server serving the specified region- Specified by:
getServerHoldingRegionin classHBaseCluster- Parameters:
tn- Table name that has the region.regionName- Name of the region in bytes- Returns:
- ServerName that hosts the region or null
- Throws:
IOException
-
countServedRegions
Deprecated.Counts the total numbers of regions being served by the currently online region servers by asking each how many regions they have. Does not look at hbase:meta at all. Count includes catalog tables.- Returns:
- number of regions being served by all region servers
-
killAll
Deprecated.Do a simulated kill all masters and regionservers. Useful when it is impossible to bring the mini-cluster back for clean shutdown. -
waitUntilShutDown
Deprecated.Description copied from class:HBaseClusterWait for HBase Cluster to shut down.- Specified by:
waitUntilShutDownin classHBaseCluster
-
findRegionsForTable
Deprecated. -
getRegionServerIndex
Deprecated. -
getMasterIndex
Deprecated.
-
TestingHBaseClusterinstead.