@InterfaceAudience.Public public interface TestingHBaseCluster
Modifier and Type | Method and Description |
---|---|
static TestingHBaseCluster |
create(TestingHBaseClusterOption option)
Create a
TestingHBaseCluster . |
Optional<ServerName> |
getActiveMasterAddress()
Get the address of active master if there is one.
|
List<ServerName> |
getBackupMasterAddresses()
Get all the backup master addresses.
|
org.apache.hadoop.conf.Configuration |
getConf()
Get configuration of this cluster.
|
Optional<OnlineRegions> |
getOnlineRegionsInterface(ServerName serverName)
Get the server side
OnlineRegions interface for the specific region server. |
Optional<Region> |
getRegion(RegionInfo regionInfo)
Get the server side
Region interface for the specific region. |
List<ServerName> |
getRegionServerAddresses()
Get all the region server addresses.
|
boolean |
isClusterRunning()
Return whether the cluster is running.
|
boolean |
isHBaseClusterRunning()
Return whether the hbase cluster is running.
|
void |
start()
Start the whole mini cluster, including zookeeper cluster, dfs cluster and hbase cluster.
|
void |
startHBaseCluster()
Start the hbase cluster.
|
void |
startMaster()
Start a new master with localhost and random port.
|
void |
startMaster(String hostname,
int port)
Start a new master bind on the given host and port.
|
void |
startRegionServer()
Start a new region server with localhost and random port.
|
void |
startRegionServer(String hostname,
int port)
Start a new region server bind on the given host and port.
|
void |
stop()
Stop the whole mini cluster, including zookeeper cluster, dfs cluster and hbase cluster.
|
void |
stopHBaseCluster()
Stop the hbase cluster.
|
CompletableFuture<Void> |
stopMaster(ServerName serverName)
Stop the given master.
|
CompletableFuture<Void> |
stopRegionServer(ServerName serverName)
Stop the given region server.
|
org.apache.hadoop.conf.Configuration getConf()
Configuration
to create
Connection
for accessing the testing cluster.void startMaster() throws Exception
Exception
void startMaster(String hostname, int port) throws Exception
Exception
CompletableFuture<Void> stopMaster(ServerName serverName) throws Exception
CompletableFuture
to wait on the master quit. The differences
comparing to Admin.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.Exception
void startRegionServer() throws Exception
Exception
void startRegionServer(String hostname, int port) throws Exception
Exception
CompletableFuture<Void> stopRegionServer(ServerName serverName) throws Exception
CompletableFuture
to wait on the master quit. The difference
comparing to Admin.stopMaster()
is that this method does
not always fail since we do not use rpc to stop the region server.Exception
void stopHBaseCluster() throws Exception
start()
first before calling this method, otherwise an
IllegalStateException
will be thrown. If the hbase is not running because you have
already stopped the cluster, an IllegalStateException
will be thrown too.Exception
void startHBaseCluster() throws Exception
stopHBaseCluster()
. If
the cluster is already running or you have not called start()
yet, an
IllegalStateException
will be thrown.Exception
boolean isHBaseClusterRunning()
void start() throws Exception
stop()
to
shutdown the cluster completely, and then you can call this method to start the whole cluster
again. An IllegalStateException
will be thrown if you call this method incorrectly.Exception
Optional<ServerName> getActiveMasterAddress()
List<ServerName> getBackupMasterAddresses()
List<ServerName> getRegionServerAddresses()
@InterfaceAudience.LimitedPrivate(value="Coprocesssor") Optional<Region> getRegion(RegionInfo regionInfo)
Region
interface for the specific region.
This is used for CPs to test something which can only be accessed at server side, such as tags.@InterfaceAudience.LimitedPrivate(value="Coprocesssor") Optional<OnlineRegions> getOnlineRegionsInterface(ServerName serverName)
OnlineRegions
interface for the specific region server.
You could list the addresses of all the region server through the
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.boolean isClusterRunning()
start()
and have not called
stop()
yet. If you want to make sure the hbase cluster is running, use
isHBaseClusterRunning()
.void stop() throws Exception
start()
, otherwise an
IllegalStateException
will be thrown.Exception
static TestingHBaseCluster create(TestingHBaseClusterOption option)
TestingHBaseCluster
. You need to call start()
of the returned
TestingHBaseCluster
to actually start the mini testing cluster.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.