Package org.apache.hadoop.hbase
Class SingleProcessHBaseCluster
java.lang.Object
org.apache.hadoop.hbase.HBaseClusterInterface
org.apache.hadoop.hbase.SingleProcessHBaseCluster
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.hadoop.conf.Configurable
@LimitedPrivate("Phoenix")
@Evolving
public class SingleProcessHBaseCluster
extends HBaseClusterInterface
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
Modifier and TypeClassDescriptionstatic class
Subclass so can get at protected methods (none at moment).(package private) static class
Alternate shutdown hook. -
Field Summary
Modifier and TypeFieldDescriptionorg.apache.hadoop.hbase.LocalHBaseCluster
private static int
private static final org.slf4j.Logger
Fields inherited from class org.apache.hadoop.hbase.HBaseClusterInterface
conf, initialClusterStatus
-
Constructor Summary
ConstructorDescriptionSingleProcessHBaseCluster
(org.apache.hadoop.conf.Configuration conf, int numRegionServers) Start a MiniHBaseCluster.SingleProcessHBaseCluster
(org.apache.hadoop.conf.Configuration conf, int numMasters, int numRegionServers) Start a MiniHBaseCluster.SingleProcessHBaseCluster
(org.apache.hadoop.conf.Configuration conf, int numMasters, int numAlwaysStandByMasters, int numRegionServers, List<Integer> rsPorts, Class<? extends org.apache.hadoop.hbase.master.HMaster> masterClass, Class<? extends SingleProcessHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) SingleProcessHBaseCluster
(org.apache.hadoop.conf.Configuration conf, int numMasters, int numRegionServers, Class<? extends org.apache.hadoop.hbase.master.HMaster> masterClass, Class<? extends SingleProcessHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) Start a MiniHBaseCluster. -
Method Summary
Modifier and TypeMethodDescriptionabortMaster
(int serverNumber) Cause a master to exit without shutting down entire cluster.abortRegionServer
(int serverNumber) Cause a region server to exit doing basic clean up only on its way out.void
close()
Closes all the resources held open for this cluster.void
compact
(boolean major) Call flushCache on all regions on all participating regionservers.void
compact
(org.apache.hadoop.hbase.TableName tableName, boolean major) Call flushCache on all regions of the specified table.long
Counts the total numbers of regions being served by the currently online region servers by asking each how many regions they have.private void
executeFlush
(org.apache.hadoop.hbase.regionserver.HRegion region) List<org.apache.hadoop.hbase.regionserver.HRegion>
findRegionsForTable
(org.apache.hadoop.hbase.TableName tableName) void
Call flushCache on all regions on all participating regionservers.void
flushcache
(org.apache.hadoop.hbase.TableName tableName) Call flushCache on all regions of the specified table.org.apache.hadoop.hbase.ClusterMetrics
Returns a ClusterMetrics for this HBase cluster.org.apache.hadoop.conf.Configuration
List<org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread>
Returns list of live master threads (skips the aborted and the killed)List<org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread>
Returns List of live region server threads (skips the aborted and the killed)org.apache.hadoop.hbase.master.HMaster
Returns the current active master, if available.org.apache.hadoop.hbase.master.HMaster
getMaster
(int serverNumber) Returns the master at the specified index, if available.protected int
getMasterIndex
(org.apache.hadoop.hbase.ServerName serverName) org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread
Returns the current active master thread, if available.List<org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread>
Returns list of master threads.int
Returns number of live region servers in the cluster currently.List<org.apache.hadoop.hbase.regionserver.HRegion>
getRegions
(byte[] tableName) List<org.apache.hadoop.hbase.regionserver.HRegion>
getRegions
(org.apache.hadoop.hbase.TableName tableName) org.apache.hadoop.hbase.regionserver.HRegionServer
getRegionServer
(int serverNumber) Grab a numbered region server of your choice.org.apache.hadoop.hbase.regionserver.HRegionServer
getRegionServer
(org.apache.hadoop.hbase.ServerName serverName) protected int
getRegionServerIndex
(org.apache.hadoop.hbase.ServerName serverName) List<org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread>
Returns list of region server threads.org.apache.hadoop.hbase.ServerName
getServerHoldingRegion
(org.apache.hadoop.hbase.TableName tn, byte[] regionName) Get the ServerName of region server serving the specified regionint
getServerWith
(byte[] regionName) Get the location of the specified regionint
Returns index into List ofgetRegionServerThreads()
of HRS carrying regionName.private void
init
(int nMasterNodes, int numAlwaysStandByMasters, int nRegionNodes, List<Integer> rsPorts, Class<? extends org.apache.hadoop.hbase.master.HMaster> masterClass, Class<? extends SingleProcessHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) 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
join()
Wait for Mini HBase Cluster to shut down.void
killAll()
Do a simulated kill all masters and regionservers.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
killJournalNode
(org.apache.hadoop.hbase.ServerName serverName) Kills the journalnode 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.org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread
resumeRegionServer
(int serverNumber) Resume the specified region servervoid
resumeRegionServer
(org.apache.hadoop.hbase.ServerName serverName) Resume the region servervoid
shutdown()
Shut down the mini HBase clustervoid
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
startJournalNode
(org.apache.hadoop.hbase.ServerName serverName) Starts a new journalnode on the given hostname or if this is a mini/local cluster, silently logs warning message.org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread
Starts a master thread runningvoid
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.org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread
Starts a region server thread runningvoid
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.private org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread
startRegionServer
(org.apache.hadoop.conf.Configuration configuration) org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread
startRegionServerAndWait
(long timeout) Starts a region server thread and waits until its processed by master.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
stopJournalNode
(org.apache.hadoop.hbase.ServerName serverName) Stops the journalnode if this is a distributed cluster, otherwise silently logs warning message.org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread
stopMaster
(int serverNumber) Shut down the specified master cleanlyorg.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread
stopMaster
(int serverNumber, boolean shutdownFS) Shut down the specified master cleanlyvoid
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.org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread
stopRegionServer
(int serverNumber) Shut down the specified region server cleanlyorg.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread
stopRegionServer
(int serverNumber, boolean shutdownFS) Shut down the specified region server cleanlyvoid
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.org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread
suspendRegionServer
(int serverNumber) Suspend the specified region servervoid
suspendRegionServer
(org.apache.hadoop.hbase.ServerName serverName) Suspend the region serverboolean
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 clustervoid
waitForDataNodeToStop
(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified datanode to stop the thread / process.void
waitForJournalNodeToStart
(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified journalnode to join the clustervoid
waitForJournalNodeToStop
(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified journalnode to stopvoid
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 clustervoid
waitForNameNodeToStop
(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified namenode to stopvoid
waitForRegionServerToStop
(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified region server to stop the thread / process.void
waitForZkNodeToStart
(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified zookeeper node to join the clustervoid
waitForZkNodeToStop
(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified zookeeper node to stop the thread / process.waitOnMaster
(int serverNumber) Wait for the specified master to stop.waitOnRegionServer
(int serverNumber) Wait for the specified region server to stop.void
Wait for HBase Cluster to shut down.Methods inherited from class org.apache.hadoop.hbase.HBaseClusterInterface
getConf, getInitialClusterMetrics, getServerHoldingMeta, isDistributedCluster, restoreClusterMetrics, restoreInitialStatus, setConf, waitForActiveAndReadyMaster, waitForDatanodesRegistered, waitForNamenodeAvailable, waitForRegionServerToStart
-
Field Details
-
LOG
-
hbaseCluster
-
index
-
-
Constructor Details
-
SingleProcessHBaseCluster
public SingleProcessHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numRegionServers) throws IOException, InterruptedException Start a MiniHBaseCluster.- Parameters:
conf
- Configuration to be used for clusternumRegionServers
- initial number of region servers to start.- Throws:
IOException
InterruptedException
-
SingleProcessHBaseCluster
public SingleProcessHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numMasters, int numRegionServers) throws IOException, InterruptedException 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:
IOException
InterruptedException
-
SingleProcessHBaseCluster
public SingleProcessHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numMasters, int numRegionServers, Class<? extends org.apache.hadoop.hbase.master.HMaster> masterClass, Class<? extends SingleProcessHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) throws IOException, InterruptedException 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:
IOException
InterruptedException
-
SingleProcessHBaseCluster
public SingleProcessHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numMasters, int numAlwaysStandByMasters, int numRegionServers, List<Integer> rsPorts, Class<? extends org.apache.hadoop.hbase.master.HMaster> masterClass, Class<? extends SingleProcessHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) throws IOException, InterruptedException - 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:
IOException
InterruptedException
-
-
Method Details
-
getConfiguration
-
init
private void init(int nMasterNodes, int numAlwaysStandByMasters, int nRegionNodes, List<Integer> rsPorts, Class<? extends org.apache.hadoop.hbase.master.HMaster> masterClass, Class<? extends SingleProcessHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
startRegionServer
Description copied from class:HBaseClusterInterface
Starts a new region server on the given hostname or if this is a mini/local cluster, starts a region server locally.- Specified by:
startRegionServer
in classHBaseClusterInterface
- Parameters:
hostname
- the hostname to start the regionserver on- Throws:
IOException
- if something goes wrong
-
killRegionServer
Description copied from class:HBaseClusterInterface
Kills 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:
killRegionServer
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong
-
isKilledRS
Description copied from class:HBaseClusterInterface
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.- Specified by:
isKilledRS
in classHBaseClusterInterface
-
stopRegionServer
Description copied from class:HBaseClusterInterface
Stops the given region server, by attempting a gradual stop.- Specified by:
stopRegionServer
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong
-
suspendRegionServer
Description copied from class:HBaseClusterInterface
Suspend the region server- Specified by:
suspendRegionServer
in classHBaseClusterInterface
- Parameters:
serverName
- the hostname to suspend the regionserver on- Throws:
IOException
- if something goes wrong
-
resumeRegionServer
Description copied from class:HBaseClusterInterface
Resume the region server- Specified by:
resumeRegionServer
in classHBaseClusterInterface
- Parameters:
serverName
- the hostname to resume the regionserver on- Throws:
IOException
- if something goes wrong
-
waitForRegionServerToStop
public void waitForRegionServerToStop(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException Description copied from class:HBaseClusterInterface
Wait for the specified region server to stop the thread / process.- Specified by:
waitForRegionServerToStop
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong or timeout occurs
-
startZkNode
Description copied from class:HBaseClusterInterface
Starts a new zookeeper node on the given hostname or if this is a mini/local cluster, silently logs warning message.- Specified by:
startZkNode
in classHBaseClusterInterface
- Parameters:
hostname
- the hostname to start the regionserver on- Throws:
IOException
- if something goes wrong
-
killZkNode
Description copied from class:HBaseClusterInterface
Kills the zookeeper node process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Specified by:
killZkNode
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong
-
stopZkNode
Description copied from class:HBaseClusterInterface
Stops the region zookeeper if this is a distributed cluster, otherwise silently logs warning message.- Specified by:
stopZkNode
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong
-
waitForZkNodeToStart
public void waitForZkNodeToStart(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException Description copied from class:HBaseClusterInterface
Wait for the specified zookeeper node to join the cluster- Specified by:
waitForZkNodeToStart
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong or timeout occurs
-
waitForZkNodeToStop
public void waitForZkNodeToStop(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException Description copied from class:HBaseClusterInterface
Wait for the specified zookeeper node to stop the thread / process.- Specified by:
waitForZkNodeToStop
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong or timeout occurs
-
startDataNode
Description copied from class:HBaseClusterInterface
Starts a new datanode on the given hostname or if this is a mini/local cluster, silently logs warning message.- Specified by:
startDataNode
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong
-
killDataNode
Description copied from class:HBaseClusterInterface
Kills the datanode process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Specified by:
killDataNode
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong
-
stopDataNode
Description copied from class:HBaseClusterInterface
Stops the datanode if this is a distributed cluster, otherwise silently logs warning message.- Specified by:
stopDataNode
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong
-
waitForDataNodeToStart
public void waitForDataNodeToStart(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException Description copied from class:HBaseClusterInterface
Wait for the specified datanode to join the cluster- Specified by:
waitForDataNodeToStart
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong or timeout occurs
-
waitForDataNodeToStop
public void waitForDataNodeToStop(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException Description copied from class:HBaseClusterInterface
Wait for the specified datanode to stop the thread / process.- Specified by:
waitForDataNodeToStop
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong or timeout occurs
-
startNameNode
Description copied from class:HBaseClusterInterface
Starts a new namenode on the given hostname or if this is a mini/local cluster, silently logs warning message.- Specified by:
startNameNode
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong
-
killNameNode
Description copied from class:HBaseClusterInterface
Kills the namenode process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Specified by:
killNameNode
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong
-
stopNameNode
Description copied from class:HBaseClusterInterface
Stops the namenode if this is a distributed cluster, otherwise silently logs warning message.- Specified by:
stopNameNode
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong
-
waitForNameNodeToStart
public void waitForNameNodeToStart(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException Description copied from class:HBaseClusterInterface
Wait for the specified namenode to join the cluster- Specified by:
waitForNameNodeToStart
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong or timeout occurs
-
waitForNameNodeToStop
public void waitForNameNodeToStop(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException Description copied from class:HBaseClusterInterface
Wait for the specified namenode to stop- Specified by:
waitForNameNodeToStop
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong or timeout occurs
-
startJournalNode
Description copied from class:HBaseClusterInterface
Starts a new journalnode on the given hostname or if this is a mini/local cluster, silently logs warning message.- Specified by:
startJournalNode
in classHBaseClusterInterface
-
killJournalNode
Description copied from class:HBaseClusterInterface
Kills the journalnode process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Specified by:
killJournalNode
in classHBaseClusterInterface
-
stopJournalNode
Description copied from class:HBaseClusterInterface
Stops the journalnode if this is a distributed cluster, otherwise silently logs warning message.- Specified by:
stopJournalNode
in classHBaseClusterInterface
-
waitForJournalNodeToStart
Description copied from class:HBaseClusterInterface
Wait for the specified journalnode to join the cluster- Specified by:
waitForJournalNodeToStart
in classHBaseClusterInterface
-
waitForJournalNodeToStop
Description copied from class:HBaseClusterInterface
Wait for the specified journalnode to stop- Specified by:
waitForJournalNodeToStop
in classHBaseClusterInterface
-
startMaster
Description copied from class:HBaseClusterInterface
Starts a new master on the given hostname or if this is a mini/local cluster, starts a master locally.- Specified by:
startMaster
in classHBaseClusterInterface
- Parameters:
hostname
- the hostname to start the master on- Throws:
IOException
- if something goes wrong
-
killMaster
Description copied from class:HBaseClusterInterface
Kills the master process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Specified by:
killMaster
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong
-
stopMaster
Description copied from class:HBaseClusterInterface
Stops the given master, by attempting a gradual stop.- Specified by:
stopMaster
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong
-
waitForMasterToStop
public void waitForMasterToStop(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException Description copied from class:HBaseClusterInterface
Wait for the specified master to stop the thread / process.- Specified by:
waitForMasterToStop
in classHBaseClusterInterface
- Throws:
IOException
- if something goes wrong or timeout occurs
-
startRegionServer
public org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread startRegionServer() throws IOExceptionStarts a region server thread running- Returns:
- New RegionServerThread
- Throws:
IOException
-
startRegionServer
private org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread startRegionServer(org.apache.hadoop.conf.Configuration configuration) throws IOException - Throws:
IOException
-
startRegionServerAndWait
public org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread startRegionServerAndWait(long timeout) throws IOException 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
Cause a region server to exit doing basic clean up only on its way out.- Parameters:
serverNumber
- Used as index into a list.
-
stopRegionServer
public org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread stopRegionServer(int serverNumber) Shut down the specified region server cleanly- Parameters:
serverNumber
- Used as index into a list.- Returns:
- the region server that was stopped
-
stopRegionServer
public org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread stopRegionServer(int serverNumber, boolean shutdownFS) 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
public org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread suspendRegionServer(int serverNumber) Suspend the specified region server- Parameters:
serverNumber
- Used as index into a list.
-
resumeRegionServer
public org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread resumeRegionServer(int serverNumber) Resume the specified region server- Parameters:
serverNumber
- Used as index into a list.
-
waitOnRegionServer
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
Starts a master thread running- Returns:
- New RegionServerThread
- Throws:
IOException
-
getMaster
Returns the current active master, if available.- Returns:
- the active HMaster, null if none is active.
-
getMasterThread
Returns the current active master thread, if available.- Returns:
- the active MasterThread, null if none is active.
-
getMaster
Returns the master at the specified index, if available.- Returns:
- the active HMaster, null if none is active.
-
abortMaster
Cause a master to exit without shutting down entire cluster.- Parameters:
serverNumber
- Used as index into a list.
-
stopMaster
Shut down the specified master cleanly- Parameters:
serverNumber
- Used as index into a list.- Returns:
- the region server that was stopped
-
stopMaster
public org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread stopMaster(int serverNumber, boolean shutdownFS) 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
Wait for the specified master to stop. Removes this thread from list of running threads.- Returns:
- Name of master that just went down.
-
waitForActiveAndReadyMaster
Blocks until there is an active master and that master has completed initialization.- Specified by:
waitForActiveAndReadyMaster
in classHBaseClusterInterface
- 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
Returns list of master threads. -
getLiveMasterThreads
Returns list of live master threads (skips the aborted and the killed) -
join
Wait for Mini HBase Cluster to shut down. -
shutdown
Shut down the mini HBase cluster- Specified by:
shutdown
in classHBaseClusterInterface
- Throws:
IOException
-
close
Description copied from class:HBaseClusterInterface
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
- Specified by:
close
in classHBaseClusterInterface
- Throws:
IOException
- See Also:
-
getClusterMetrics
Description copied from class:HBaseClusterInterface
Returns a ClusterMetrics for this HBase cluster.- Specified by:
getClusterMetrics
in classHBaseClusterInterface
- Throws:
IOException
- See Also:
-
executeFlush
- Throws:
IOException
-
flushcache
Call flushCache on all regions on all participating regionservers.- Throws:
IOException
-
flushcache
Call flushCache on all regions of the specified table.- Throws:
IOException
-
compact
Call flushCache on all regions on all participating regionservers.- Throws:
IOException
-
compact
Call flushCache on all regions of the specified table.- Throws:
IOException
-
getNumLiveRegionServers
Returns number of live region servers in the cluster currently. -
getRegionServerThreads
public List<org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread> getRegionServerThreads()Returns list of region server threads. Does not return the master even though it is also a region server. -
getLiveRegionServerThreads
public List<org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread> getLiveRegionServerThreads()Returns List of live region server threads (skips the aborted and the killed) -
getRegionServer
Grab a numbered region server of your choice.- Returns:
- region server
-
getRegionServer
public org.apache.hadoop.hbase.regionserver.HRegionServer getRegionServer(org.apache.hadoop.hbase.ServerName serverName) -
getRegions
-
getRegions
public List<org.apache.hadoop.hbase.regionserver.HRegion> getRegions(org.apache.hadoop.hbase.TableName tableName) -
getServerWithMeta
Returns index into List ofgetRegionServerThreads()
of HRS carrying regionName. Returns -1 if none found. -
getServerWith
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
public org.apache.hadoop.hbase.ServerName getServerHoldingRegion(org.apache.hadoop.hbase.TableName tn, byte[] regionName) throws IOException Description copied from class:HBaseClusterInterface
Get the ServerName of region server serving the specified region- Specified by:
getServerHoldingRegion
in classHBaseClusterInterface
- 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
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
Do a simulated kill all masters and regionservers. Useful when it is impossible to bring the mini-cluster back for clean shutdown. -
waitUntilShutDown
Description copied from class:HBaseClusterInterface
Wait for HBase Cluster to shut down.- Specified by:
waitUntilShutDown
in classHBaseClusterInterface
-
findRegionsForTable
public List<org.apache.hadoop.hbase.regionserver.HRegion> findRegionsForTable(org.apache.hadoop.hbase.TableName tableName) -
getRegionServerIndex
-
getMasterIndex
-