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
Nested ClassesModifier and TypeClassDescriptionstatic classSubclass so can get at protected methods (none at moment).(package private) static classAlternate shutdown hook. -
Field Summary
FieldsModifier and TypeFieldDescriptionorg.apache.hadoop.hbase.LocalHBaseClusterprivate static intprivate static final org.slf4j.LoggerFields inherited from class org.apache.hadoop.hbase.HBaseClusterInterface
conf, initialClusterStatus -
Constructor Summary
ConstructorsConstructorDescriptionSingleProcessHBaseCluster(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.voidclose()Closes all the resources held open for this cluster.voidcompact(boolean major) Call flushCache on all regions on all participating regionservers.voidcompact(org.apache.hadoop.hbase.TableName tableName, boolean major) Call flushCache on all regions of the specified table.longCounts the total numbers of regions being served by the currently online region servers by asking each how many regions they have.private voidexecuteFlush(org.apache.hadoop.hbase.regionserver.HRegion region) List<org.apache.hadoop.hbase.regionserver.HRegion>findRegionsForTable(org.apache.hadoop.hbase.TableName tableName) voidCall flushCache on all regions on all participating regionservers.voidflushcache(org.apache.hadoop.hbase.TableName tableName) Call flushCache on all regions of the specified table.org.apache.hadoop.hbase.ClusterMetricsReturns a ClusterMetrics for this HBase cluster.org.apache.hadoop.conf.ConfigurationList<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.HMasterReturns the current active master, if available.org.apache.hadoop.hbase.master.HMastergetMaster(int serverNumber) Returns the master at the specified index, if available.protected intgetMasterIndex(org.apache.hadoop.hbase.ServerName serverName) org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThreadReturns the current active master thread, if available.List<org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread>Returns list of master threads.intReturns 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.HRegionServergetRegionServer(int serverNumber) Grab a numbered region server of your choice.org.apache.hadoop.hbase.regionserver.HRegionServergetRegionServer(org.apache.hadoop.hbase.ServerName serverName) protected intgetRegionServerIndex(org.apache.hadoop.hbase.ServerName serverName) List<org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread>Returns list of region server threads.org.apache.hadoop.hbase.ServerNamegetServerHoldingRegion(org.apache.hadoop.hbase.TableName tn, byte[] regionName) Get the ServerName of region server serving the specified regionintgetServerWith(byte[] regionName) Get the location of the specified regionintReturns index into List ofgetRegionServerThreads()of HRS carrying regionName.private voidinit(int nMasterNodes, int numAlwaysStandByMasters, int nRegionNodes, List<Integer> rsPorts, Class<? extends org.apache.hadoop.hbase.master.HMaster> masterClass, Class<? extends SingleProcessHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) booleanisKilledRS(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.voidjoin()Wait for Mini HBase Cluster to shut down.voidkillAll()Do a simulated kill all masters and regionservers.voidkillDataNode(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.voidkillJournalNode(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.voidkillMaster(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.voidkillNameNode(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.voidkillRegionServer(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.voidkillZkNode(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.RegionServerThreadresumeRegionServer(int serverNumber) Resume the specified region servervoidresumeRegionServer(org.apache.hadoop.hbase.ServerName serverName) Resume the region servervoidshutdown()Shut down the mini HBase clustervoidstartDataNode(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.voidstartJournalNode(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.MasterThreadStarts a master thread runningvoidstartMaster(String hostname, int port) Starts a new master on the given hostname or if this is a mini/local cluster, starts a master locally.voidstartNameNode(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.RegionServerThreadStarts a region server thread runningvoidstartRegionServer(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.RegionServerThreadstartRegionServer(org.apache.hadoop.conf.Configuration configuration) org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThreadstartRegionServerAndWait(long timeout) Starts a region server thread and waits until its processed by master.voidstartZkNode(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.voidstopDataNode(org.apache.hadoop.hbase.ServerName serverName) Stops the datanode if this is a distributed cluster, otherwise silently logs warning message.voidstopJournalNode(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.MasterThreadstopMaster(int serverNumber) Shut down the specified master cleanlyorg.apache.hadoop.hbase.util.JVMClusterUtil.MasterThreadstopMaster(int serverNumber, boolean shutdownFS) Shut down the specified master cleanlyvoidstopMaster(org.apache.hadoop.hbase.ServerName serverName) Stops the given master, by attempting a gradual stop.voidstopNameNode(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.RegionServerThreadstopRegionServer(int serverNumber) Shut down the specified region server cleanlyorg.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThreadstopRegionServer(int serverNumber, boolean shutdownFS) Shut down the specified region server cleanlyvoidstopRegionServer(org.apache.hadoop.hbase.ServerName serverName) Stops the given region server, by attempting a gradual stop.voidstopZkNode(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.RegionServerThreadsuspendRegionServer(int serverNumber) Suspend the specified region servervoidsuspendRegionServer(org.apache.hadoop.hbase.ServerName serverName) Suspend the region serverbooleanwaitForActiveAndReadyMaster(long timeout) Blocks until there is an active master and that master has completed initialization.voidwaitForDataNodeToStart(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified datanode to join the clustervoidwaitForDataNodeToStop(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified datanode to stop the thread / process.voidwaitForJournalNodeToStart(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified journalnode to join the clustervoidwaitForJournalNodeToStop(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified journalnode to stopvoidwaitForMasterToStop(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified master to stop the thread / process.voidwaitForNameNodeToStart(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified namenode to join the clustervoidwaitForNameNodeToStop(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified namenode to stopvoidwaitForRegionServerToResume(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified region server to resume the thread / process.voidwaitForRegionServerToStop(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified region server to stop the thread / process.voidwaitForRegionServerToSuspend(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified region server to suspend the thread / process.voidwaitForZkNodeToStart(org.apache.hadoop.hbase.ServerName serverName, long timeout) Wait for the specified zookeeper node to join the clustervoidwaitForZkNodeToStop(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.voidWait 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:
IOExceptionInterruptedException
-
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:
IOExceptionInterruptedException
-
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:
IOExceptionInterruptedException
-
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:
IOExceptionInterruptedException
-
-
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:
IOExceptionInterruptedException
-
startRegionServer
Description copied from class:HBaseClusterInterfaceStarts a new region server on the given hostname or if this is a mini/local cluster, starts a region server locally.- Specified by:
startRegionServerin classHBaseClusterInterface- Parameters:
hostname- the hostname to start the regionserver on- Throws:
IOException- if something goes wrong
-
killRegionServer
Description copied from class:HBaseClusterInterfaceKills 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 classHBaseClusterInterface- Throws:
IOException- if something goes wrong
-
isKilledRS
Description copied from class:HBaseClusterInterfaceKeeping 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 classHBaseClusterInterface
-
stopRegionServer
Description copied from class:HBaseClusterInterfaceStops the given region server, by attempting a gradual stop.- Specified by:
stopRegionServerin classHBaseClusterInterface- Throws:
IOException- if something goes wrong
-
suspendRegionServer
Description copied from class:HBaseClusterInterfaceSuspend the region server- Specified by:
suspendRegionServerin classHBaseClusterInterface- Parameters:
serverName- the hostname to suspend the regionserver on- Throws:
IOException- if something goes wrong
-
resumeRegionServer
Description copied from class:HBaseClusterInterfaceResume the region server- Specified by:
resumeRegionServerin 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:HBaseClusterInterfaceWait for the specified region server to stop the thread / process.- Specified by:
waitForRegionServerToStopin classHBaseClusterInterface- Throws:
IOException- if something goes wrong or timeout occurs
-
waitForRegionServerToSuspend
public void waitForRegionServerToSuspend(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException Description copied from class:HBaseClusterInterfaceWait for the specified region server to suspend the thread / process.- Specified by:
waitForRegionServerToSuspendin classHBaseClusterInterface- Throws:
IOException- if something goes wrong or timeout occurs
-
waitForRegionServerToResume
public void waitForRegionServerToResume(org.apache.hadoop.hbase.ServerName serverName, long timeout) throws IOException Description copied from class:HBaseClusterInterfaceWait for the specified region server to resume the thread / process.- Specified by:
waitForRegionServerToResumein classHBaseClusterInterface- Throws:
IOException- if something goes wrong or timeout occurs
-
startZkNode
Description copied from class:HBaseClusterInterfaceStarts a new zookeeper node on the given hostname or if this is a mini/local cluster, silently logs warning message.- Specified by:
startZkNodein classHBaseClusterInterface- Parameters:
hostname- the hostname to start the regionserver on- Throws:
IOException- if something goes wrong
-
killZkNode
Description copied from class:HBaseClusterInterfaceKills the zookeeper node process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Specified by:
killZkNodein classHBaseClusterInterface- Throws:
IOException- if something goes wrong
-
stopZkNode
Description copied from class:HBaseClusterInterfaceStops the region zookeeper if this is a distributed cluster, otherwise silently logs warning message.- Specified by:
stopZkNodein 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:HBaseClusterInterfaceWait for the specified zookeeper node to join the cluster- Specified by:
waitForZkNodeToStartin 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:HBaseClusterInterfaceWait for the specified zookeeper node to stop the thread / process.- Specified by:
waitForZkNodeToStopin classHBaseClusterInterface- Throws:
IOException- if something goes wrong or timeout occurs
-
startDataNode
Description copied from class:HBaseClusterInterfaceStarts a new datanode on the given hostname or if this is a mini/local cluster, silently logs warning message.- Specified by:
startDataNodein classHBaseClusterInterface- Throws:
IOException- if something goes wrong
-
killDataNode
Description copied from class:HBaseClusterInterfaceKills the datanode process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Specified by:
killDataNodein classHBaseClusterInterface- Throws:
IOException- if something goes wrong
-
stopDataNode
Description copied from class:HBaseClusterInterfaceStops the datanode if this is a distributed cluster, otherwise silently logs warning message.- Specified by:
stopDataNodein 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:HBaseClusterInterfaceWait for the specified datanode to join the cluster- Specified by:
waitForDataNodeToStartin 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:HBaseClusterInterfaceWait for the specified datanode to stop the thread / process.- Specified by:
waitForDataNodeToStopin classHBaseClusterInterface- Throws:
IOException- if something goes wrong or timeout occurs
-
startNameNode
Description copied from class:HBaseClusterInterfaceStarts a new namenode on the given hostname or if this is a mini/local cluster, silently logs warning message.- Specified by:
startNameNodein classHBaseClusterInterface- Throws:
IOException- if something goes wrong
-
killNameNode
Description copied from class:HBaseClusterInterfaceKills the namenode process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Specified by:
killNameNodein classHBaseClusterInterface- Throws:
IOException- if something goes wrong
-
stopNameNode
Description copied from class:HBaseClusterInterfaceStops the namenode if this is a distributed cluster, otherwise silently logs warning message.- Specified by:
stopNameNodein 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:HBaseClusterInterfaceWait for the specified namenode to join the cluster- Specified by:
waitForNameNodeToStartin 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:HBaseClusterInterfaceWait for the specified namenode to stop- Specified by:
waitForNameNodeToStopin classHBaseClusterInterface- Throws:
IOException- if something goes wrong or timeout occurs
-
startJournalNode
Description copied from class:HBaseClusterInterfaceStarts a new journalnode on the given hostname or if this is a mini/local cluster, silently logs warning message.- Specified by:
startJournalNodein classHBaseClusterInterface
-
killJournalNode
Description copied from class:HBaseClusterInterfaceKills the journalnode process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Specified by:
killJournalNodein classHBaseClusterInterface
-
stopJournalNode
Description copied from class:HBaseClusterInterfaceStops the journalnode if this is a distributed cluster, otherwise silently logs warning message.- Specified by:
stopJournalNodein classHBaseClusterInterface
-
waitForJournalNodeToStart
Description copied from class:HBaseClusterInterfaceWait for the specified journalnode to join the cluster- Specified by:
waitForJournalNodeToStartin classHBaseClusterInterface
-
waitForJournalNodeToStop
Description copied from class:HBaseClusterInterfaceWait for the specified journalnode to stop- Specified by:
waitForJournalNodeToStopin classHBaseClusterInterface
-
startMaster
Description copied from class:HBaseClusterInterfaceStarts a new master on the given hostname or if this is a mini/local cluster, starts a master locally.- Specified by:
startMasterin classHBaseClusterInterface- Parameters:
hostname- the hostname to start the master on- Throws:
IOException- if something goes wrong
-
killMaster
Description copied from class:HBaseClusterInterfaceKills the master process if this is a distributed cluster, otherwise, this causes master to exit doing basic clean up only.- Specified by:
killMasterin classHBaseClusterInterface- Throws:
IOException- if something goes wrong
-
stopMaster
Description copied from class:HBaseClusterInterfaceStops the given master, by attempting a gradual stop.- Specified by:
stopMasterin 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:HBaseClusterInterfaceWait for the specified master to stop the thread / process.- Specified by:
waitForMasterToStopin 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:
waitForActiveAndReadyMasterin 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:
shutdownin classHBaseClusterInterface- Throws:
IOException
-
close
Description copied from class:HBaseClusterInterfaceCloses 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 classHBaseClusterInterface- Throws:
IOException- See Also:
-
getClusterMetrics
Description copied from class:HBaseClusterInterfaceReturns a ClusterMetrics for this HBase cluster.- Specified by:
getClusterMetricsin 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:HBaseClusterInterfaceGet the ServerName of region server serving the specified region- Specified by:
getServerHoldingRegionin 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:HBaseClusterInterfaceWait for HBase Cluster to shut down.- Specified by:
waitUntilShutDownin classHBaseClusterInterface
-
findRegionsForTable
public List<org.apache.hadoop.hbase.regionserver.HRegion> findRegionsForTable(org.apache.hadoop.hbase.TableName tableName) -
getRegionServerIndex
-
getMasterIndex
-