Package org.apache.hadoop.hbase.testing
Class TestingHBaseClusterImpl
java.lang.Object
org.apache.hadoop.hbase.testing.TestingHBaseClusterImpl
- All Implemented Interfaces:
TestingHBaseCluster
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ExecutorServiceprivate final Stringprivate final Stringprivate booleanprivate booleanprivate final StartTestingClusterOptionprivate final HBaseTestingUtil -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the address of active master if there is one.Get all the backup master addresses.org.apache.hadoop.conf.ConfigurationgetConf()Get configuration of this cluster.private intgetMasterIndex(ServerName serverName) getOnlineRegionsInterface(ServerName serverName) Get the server sideOnlineRegionsinterface for the specific region server.getRegion(RegionInfo regionInfo) Get the server sideRegioninterface for the specific region.Get all the region server addresses.private intgetRegionServerIndex(ServerName serverName) booleanReturn whether the cluster is running.booleanReturn whether the hbase cluster is running.private voidjoin(Thread thread, CompletableFuture<?> future) voidstart()Start the whole mini cluster, including zookeeper cluster, dfs cluster and hbase cluster.voidStart the hbase cluster.voidStart a new master with localhost and random port.voidstartMaster(String hostname, int port) Start a new master bind on the given host and port.voidStart a new region server with localhost and random port.voidstartRegionServer(String hostname, int port) Start a new region server bind on the given host and port.voidstop()Stop the whole mini cluster, including zookeeper cluster, dfs cluster and hbase cluster.voidStop the hbase cluster.stopMaster(ServerName serverName) Stop the given master.stopRegionServer(ServerName serverName) Stop the given region server.
-
Field Details
-
util
-
option
-
externalDfsUri
-
externalZkConnectString
-
executor
-
miniClusterRunning
-
miniHBaseClusterRunning
-
-
Constructor Details
-
TestingHBaseClusterImpl
-
-
Method Details
-
getConf
Description copied from interface:TestingHBaseClusterGet configuration of this cluster. You could use the returnedConfigurationto createConnectionfor accessing the testing cluster.- Specified by:
getConfin interfaceTestingHBaseCluster
-
getRegionServerIndex
-
getMasterIndex
-
join
-
stopMaster
Description copied from interface:TestingHBaseClusterStop the given master. Wait on the returnedCompletableFutureto wait on the master quit. The differences comparing toAdmin.stopMaster()is that first, we could also stop backup masters here, second, this method does not always fail since we do not use rpc to stop the master.- Specified by:
stopMasterin interfaceTestingHBaseCluster- Throws:
Exception
-
stopRegionServer
Description copied from interface:TestingHBaseClusterStop the given region server. Wait on the returnedCompletableFutureto wait on the master quit. The difference comparing toAdmin.stopMaster()is that this method does not always fail since we do not use rpc to stop the region server.- Specified by:
stopRegionServerin interfaceTestingHBaseCluster- Throws:
Exception
-
stopHBaseCluster
Description copied from interface:TestingHBaseClusterStop the hbase cluster. You need to callTestingHBaseCluster.start()first before calling this method, otherwise anIllegalStateExceptionwill be thrown. If the hbase is not running because you have already stopped the cluster, anIllegalStateExceptionwill be thrown too.- Specified by:
stopHBaseClusterin interfaceTestingHBaseCluster- Throws:
Exception
-
startHBaseCluster
Description copied from interface:TestingHBaseClusterStart the hbase cluster. This is used to start the hbase cluster again after you callTestingHBaseCluster.stopHBaseCluster(). If the cluster is already running or you have not calledTestingHBaseCluster.start()yet, anIllegalStateExceptionwill be thrown.- Specified by:
startHBaseClusterin interfaceTestingHBaseCluster- Throws:
Exception
-
start
Description copied from interface:TestingHBaseClusterStart the whole mini cluster, including zookeeper cluster, dfs cluster and hbase cluster. You can only call this method once at the beginning, unless you have calledTestingHBaseCluster.stop()to shutdown the cluster completely, and then you can call this method to start the whole cluster again. AnIllegalStateExceptionwill be thrown if you call this method incorrectly.- Specified by:
startin interfaceTestingHBaseCluster- Throws:
Exception
-
stop
Description copied from interface:TestingHBaseClusterStop the whole mini cluster, including zookeeper cluster, dfs cluster and hbase cluster. You can only call this method after callingTestingHBaseCluster.start(), otherwise anIllegalStateExceptionwill be thrown.- Specified by:
stopin interfaceTestingHBaseCluster- Throws:
Exception
-
isHBaseClusterRunning
Description copied from interface:TestingHBaseClusterReturn whether the hbase cluster is running.- Specified by:
isHBaseClusterRunningin interfaceTestingHBaseCluster
-
isClusterRunning
Description copied from interface:TestingHBaseClusterReturn whether the cluster is running. Notice that, this only means you have calledTestingHBaseCluster.start()and have not calledTestingHBaseCluster.stop()yet. If you want to make sure the hbase cluster is running, useTestingHBaseCluster.isHBaseClusterRunning().- Specified by:
isClusterRunningin interfaceTestingHBaseCluster
-
startMaster
Description copied from interface:TestingHBaseClusterStart a new master with localhost and random port.- Specified by:
startMasterin interfaceTestingHBaseCluster- Throws:
Exception
-
startMaster
Description copied from interface:TestingHBaseClusterStart a new master bind on the given host and port.- Specified by:
startMasterin interfaceTestingHBaseCluster- Throws:
Exception
-
startRegionServer
Description copied from interface:TestingHBaseClusterStart a new region server with localhost and random port.- Specified by:
startRegionServerin interfaceTestingHBaseCluster- Throws:
Exception
-
startRegionServer
Description copied from interface:TestingHBaseClusterStart a new region server bind on the given host and port.- Specified by:
startRegionServerin interfaceTestingHBaseCluster- Throws:
Exception
-
getActiveMasterAddress
Description copied from interface:TestingHBaseClusterGet the address of active master if there is one.- Specified by:
getActiveMasterAddressin interfaceTestingHBaseCluster
-
getBackupMasterAddresses
Description copied from interface:TestingHBaseClusterGet all the backup master addresses.- Specified by:
getBackupMasterAddressesin interfaceTestingHBaseCluster
-
getRegionServerAddresses
Description copied from interface:TestingHBaseClusterGet all the region server addresses.- Specified by:
getRegionServerAddressesin interfaceTestingHBaseCluster
-
getRegion
Description copied from interface:TestingHBaseClusterGet the server sideRegioninterface for the specific region. This is used for CPs to test something which can only be accessed at server side, such as tags.- Specified by:
getRegionin interfaceTestingHBaseCluster
-
getOnlineRegionsInterface
Description copied from interface:TestingHBaseClusterGet the server sideOnlineRegionsinterface for the specific region server. You could list the addresses of all the region server through theTestingHBaseCluster.getRegionServerAddresses()method. This is used for CPs to test something which can only be accessed at server side, such as tags. And also you could use the returned interface to get all regions on this region server, etc.- Specified by:
getOnlineRegionsInterfacein interfaceTestingHBaseCluster
-