@InterfaceAudience.Public public class MiniHBaseCluster extends HBaseCluster
Modifier and Type | Field and Description |
---|---|
LocalHBaseCluster |
hbaseCluster |
conf, initialClusterStatus
Constructor and Description |
---|
MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf,
int numRegionServers)
Start a MiniHBaseCluster.
|
MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf,
int numMasters,
int numRegionServers)
Start a MiniHBaseCluster.
|
MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf,
int numMasters,
int numRegionServers,
Class<? extends HMaster> masterClass,
Class<? extends MiniHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass)
Start a MiniHBaseCluster.
|
MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf,
int numMasters,
int numRegionServers,
List<Integer> rsPorts,
Class<? extends HMaster> masterClass,
Class<? extends MiniHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) |
Modifier and Type | Method and Description |
---|---|
String |
abortMaster(int serverNumber)
Cause a master to exit without shutting down entire cluster.
|
String |
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(TableName tableName,
boolean major)
Call flushCache on all regions of the specified table.
|
long |
countServedRegions()
Counts the total numbers of regions being served by the currently online
region servers by asking each how many regions they have.
|
List<HRegion> |
findRegionsForTable(TableName tableName) |
void |
flushcache()
Call flushCache on all regions on all participating regionservers.
|
void |
flushcache(TableName tableName)
Call flushCache on all regions of the specified table.
|
org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface |
getAdminProtocol(ServerName serverName)
Returns an AdminProtocol interface to the regionserver
|
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface |
getClientProtocol(ServerName serverName)
Returns a ClientProtocol interface to the regionserver
|
ClusterMetrics |
getClusterMetrics()
Returns a ClusterMetrics for this HBase cluster.
|
ClusterStatus |
getClusterStatus()
Deprecated.
As of release 2.0.0, this will be removed in HBase 3.0.0
Use
getClusterMetrics() instead. |
org.apache.hadoop.conf.Configuration |
getConfiguration() |
List<JVMClusterUtil.MasterThread> |
getLiveMasterThreads() |
List<JVMClusterUtil.RegionServerThread> |
getLiveRegionServerThreads() |
HMaster |
getMaster()
Returns the current active master, if available.
|
HMaster |
getMaster(int serverNumber)
Returns the master at the specified index, if available.
|
org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.BlockingInterface |
getMasterAdminService()
Returns the current active master, if available.
|
protected int |
getMasterIndex(ServerName serverName) |
JVMClusterUtil.MasterThread |
getMasterThread()
Returns the current active master thread, if available.
|
List<JVMClusterUtil.MasterThread> |
getMasterThreads() |
List<HRegion> |
getRegions(byte[] tableName) |
List<HRegion> |
getRegions(TableName tableName) |
HRegionServer |
getRegionServer(int serverNumber)
Grab a numbered region server of your choice.
|
HRegionServer |
getRegionServer(ServerName serverName) |
protected int |
getRegionServerIndex(ServerName serverName) |
List<JVMClusterUtil.RegionServerThread> |
getRegionServerThreads() |
ServerName |
getServerHoldingRegion(TableName tn,
byte[] regionName)
Get the ServerName of region server serving the specified region
|
int |
getServerWith(byte[] regionName)
Get the location of the specified region
|
int |
getServerWithMeta() |
boolean |
isKilledRS(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(ServerName serverName)
Kills the datanode process if this is a distributed cluster, otherwise,
this causes master to exit doing basic clean up only.
|
void |
killMaster(ServerName serverName)
Kills the master process if this is a distributed cluster, otherwise,
this causes master to exit doing basic clean up only.
|
void |
killRegionServer(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(ServerName serverName)
Kills the zookeeper node process if this is a distributed cluster, otherwise,
this causes master to exit doing basic clean up only.
|
void |
shutdown()
Shut down the mini HBase cluster
|
void |
startDataNode(ServerName serverName)
Starts a new datanode on the given hostname or if this is a mini/local cluster,
silently logs warning message.
|
JVMClusterUtil.MasterThread |
startMaster()
Starts a master thread running
|
void |
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.
|
JVMClusterUtil.RegionServerThread |
startRegionServer()
Starts a region server thread running
|
void |
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.
|
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(ServerName serverName)
Stops the datanode if this is a distributed cluster, otherwise
silently logs warning message.
|
JVMClusterUtil.MasterThread |
stopMaster(int serverNumber)
Shut down the specified master cleanly
|
JVMClusterUtil.MasterThread |
stopMaster(int serverNumber,
boolean shutdownFS)
Shut down the specified master cleanly
|
void |
stopMaster(ServerName serverName)
Stops the given master, by attempting a gradual stop.
|
JVMClusterUtil.RegionServerThread |
stopRegionServer(int serverNumber)
Shut down the specified region server cleanly
|
JVMClusterUtil.RegionServerThread |
stopRegionServer(int serverNumber,
boolean shutdownFS)
Shut down the specified region server cleanly
|
void |
stopRegionServer(ServerName serverName)
Stops the given region server, by attempting a gradual stop.
|
void |
stopZkNode(ServerName serverName)
Stops the region zookeeper if this is a distributed cluster, otherwise
silently logs warning message.
|
boolean |
waitForActiveAndReadyMaster(long timeout)
Blocks until there is an active master and that master has completed
initialization.
|
void |
waitForDataNodeToStart(ServerName serverName,
long timeout)
Wait for the specified datanode to join the cluster
|
void |
waitForDataNodeToStop(ServerName serverName,
long timeout)
Wait for the specified datanode to stop the thread / process.
|
void |
waitForMasterToStop(ServerName serverName,
long timeout)
Wait for the specified master to stop the thread / process.
|
void |
waitForRegionServerToStop(ServerName serverName,
long timeout)
Wait for the specified region server to stop the thread / process.
|
void |
waitForZkNodeToStart(ServerName serverName,
long timeout)
Wait for the specified zookeeper node to join the cluster
|
void |
waitForZkNodeToStop(ServerName serverName,
long timeout)
Wait for the specified zookeeper node to stop the thread / process.
|
String |
waitOnMaster(int serverNumber)
Wait for the specified master to stop.
|
String |
waitOnRegionServer(int serverNumber)
Wait for the specified region server to stop.
|
void |
waitUntilShutDown()
Wait for HBase Cluster to shut down.
|
getConf, getInitialClusterMetrics, getServerHoldingMeta, isDistributedCluster, restoreClusterMetrics, restoreInitialStatus, setConf, waitForActiveAndReadyMaster, waitForDatanodesRegistered, waitForNamenodeAvailable, waitForRegionServerToStart
public LocalHBaseCluster hbaseCluster
public MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numRegionServers) throws IOException, InterruptedException
conf
- Configuration to be used for clusternumRegionServers
- initial number of region servers to start.IOException
InterruptedException
public MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numMasters, int numRegionServers) throws IOException, InterruptedException
conf
- Configuration to be used for clusternumMasters
- initial number of masters to start.numRegionServers
- initial number of region servers to start.IOException
InterruptedException
public MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numMasters, int numRegionServers, Class<? extends HMaster> masterClass, Class<? extends MiniHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) throws IOException, InterruptedException
conf
- Configuration to be used for clusternumMasters
- initial number of masters to start.numRegionServers
- initial number of region servers to start.IOException
InterruptedException
public MiniHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numMasters, int numRegionServers, List<Integer> rsPorts, Class<? extends HMaster> masterClass, Class<? extends MiniHBaseCluster.MiniHBaseClusterRegionServer> regionserverClass) throws IOException, InterruptedException
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.IOException
InterruptedException
public org.apache.hadoop.conf.Configuration getConfiguration()
public void startRegionServer(String hostname, int port) throws IOException
org.apache.hadoop.hbase.HBaseCluster
startRegionServer
in class HBaseCluster
hostname
- the hostname to start the regionserver onIOException
- if something goes wrongpublic void killRegionServer(ServerName serverName) throws IOException
org.apache.hadoop.hbase.HBaseCluster
killRegionServer
in class HBaseCluster
IOException
- if something goes wrongpublic boolean isKilledRS(ServerName serverName)
org.apache.hadoop.hbase.HBaseCluster
isKilledRS
in class HBaseCluster
public void stopRegionServer(ServerName serverName) throws IOException
org.apache.hadoop.hbase.HBaseCluster
stopRegionServer
in class HBaseCluster
IOException
- if something goes wrongpublic void waitForRegionServerToStop(ServerName serverName, long timeout) throws IOException
org.apache.hadoop.hbase.HBaseCluster
waitForRegionServerToStop
in class HBaseCluster
IOException
- if something goes wrong or timeout occurspublic void startZkNode(String hostname, int port) throws IOException
org.apache.hadoop.hbase.HBaseCluster
startZkNode
in class HBaseCluster
hostname
- the hostname to start the regionserver onIOException
- if something goes wrongpublic void killZkNode(ServerName serverName) throws IOException
org.apache.hadoop.hbase.HBaseCluster
killZkNode
in class HBaseCluster
IOException
- if something goes wrongpublic void stopZkNode(ServerName serverName) throws IOException
org.apache.hadoop.hbase.HBaseCluster
stopZkNode
in class HBaseCluster
IOException
- if something goes wrongpublic void waitForZkNodeToStart(ServerName serverName, long timeout) throws IOException
org.apache.hadoop.hbase.HBaseCluster
waitForZkNodeToStart
in class HBaseCluster
IOException
- if something goes wrong or timeout occurspublic void waitForZkNodeToStop(ServerName serverName, long timeout) throws IOException
org.apache.hadoop.hbase.HBaseCluster
waitForZkNodeToStop
in class HBaseCluster
IOException
- if something goes wrong or timeout occurspublic void startDataNode(ServerName serverName) throws IOException
org.apache.hadoop.hbase.HBaseCluster
startDataNode
in class HBaseCluster
IOException
- if something goes wrongpublic void killDataNode(ServerName serverName) throws IOException
org.apache.hadoop.hbase.HBaseCluster
killDataNode
in class HBaseCluster
IOException
- if something goes wrongpublic void stopDataNode(ServerName serverName) throws IOException
org.apache.hadoop.hbase.HBaseCluster
stopDataNode
in class HBaseCluster
IOException
- if something goes wrongpublic void waitForDataNodeToStart(ServerName serverName, long timeout) throws IOException
org.apache.hadoop.hbase.HBaseCluster
waitForDataNodeToStart
in class HBaseCluster
IOException
- if something goes wrong or timeout occurspublic void waitForDataNodeToStop(ServerName serverName, long timeout) throws IOException
org.apache.hadoop.hbase.HBaseCluster
waitForDataNodeToStop
in class HBaseCluster
IOException
- if something goes wrong or timeout occurspublic void startMaster(String hostname, int port) throws IOException
org.apache.hadoop.hbase.HBaseCluster
startMaster
in class HBaseCluster
hostname
- the hostname to start the master onIOException
- if something goes wrongpublic void killMaster(ServerName serverName) throws IOException
org.apache.hadoop.hbase.HBaseCluster
killMaster
in class HBaseCluster
IOException
- if something goes wrongpublic void stopMaster(ServerName serverName) throws IOException
org.apache.hadoop.hbase.HBaseCluster
stopMaster
in class HBaseCluster
IOException
- if something goes wrongpublic void waitForMasterToStop(ServerName serverName, long timeout) throws IOException
org.apache.hadoop.hbase.HBaseCluster
waitForMasterToStop
in class HBaseCluster
IOException
- if something goes wrong or timeout occurspublic JVMClusterUtil.RegionServerThread startRegionServer() throws IOException
IOException
public JVMClusterUtil.RegionServerThread startRegionServerAndWait(long timeout) throws IOException
IOException
public String abortRegionServer(int serverNumber)
serverNumber
- Used as index into a list.public JVMClusterUtil.RegionServerThread stopRegionServer(int serverNumber)
serverNumber
- Used as index into a list.public JVMClusterUtil.RegionServerThread stopRegionServer(int serverNumber, boolean shutdownFS)
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.public String waitOnRegionServer(int serverNumber)
serverNumber
- public JVMClusterUtil.MasterThread startMaster() throws IOException
IOException
public org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService.BlockingInterface getMasterAdminService()
getMasterAdminService
in class HBaseCluster
public HMaster getMaster()
public JVMClusterUtil.MasterThread getMasterThread()
public HMaster getMaster(int serverNumber)
public String abortMaster(int serverNumber)
serverNumber
- Used as index into a list.public JVMClusterUtil.MasterThread stopMaster(int serverNumber)
serverNumber
- Used as index into a list.public JVMClusterUtil.MasterThread stopMaster(int serverNumber, boolean shutdownFS)
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.public String waitOnMaster(int serverNumber)
serverNumber
- public boolean waitForActiveAndReadyMaster(long timeout) throws IOException
waitForActiveAndReadyMaster
in class HBaseCluster
timeout
- the timeout limit in msInterruptedException
IOException
public List<JVMClusterUtil.MasterThread> getMasterThreads()
public List<JVMClusterUtil.MasterThread> getLiveMasterThreads()
public void join()
public void shutdown() throws IOException
shutdown
in class HBaseCluster
IOException
public void close() throws IOException
org.apache.hadoop.hbase.HBaseCluster
close
in interface Closeable
close
in interface AutoCloseable
close
in class HBaseCluster
IOException
HBaseCluster.shutdown()
@Deprecated public ClusterStatus getClusterStatus() throws IOException
getClusterMetrics()
instead.IOException
public ClusterMetrics getClusterMetrics() throws IOException
org.apache.hadoop.hbase.HBaseCluster
getClusterMetrics
in class HBaseCluster
IOException
HBaseCluster.getInitialClusterMetrics()
public void flushcache() throws IOException
IOException
public void flushcache(TableName tableName) throws IOException
IOException
public void compact(boolean major) throws IOException
IOException
public void compact(TableName tableName, boolean major) throws IOException
IOException
public List<JVMClusterUtil.RegionServerThread> getRegionServerThreads()
public List<JVMClusterUtil.RegionServerThread> getLiveRegionServerThreads()
public HRegionServer getRegionServer(int serverNumber)
serverNumber
- public HRegionServer getRegionServer(ServerName serverName)
public List<HRegion> getRegions(byte[] tableName)
public List<HRegion> getRegions(TableName tableName)
public int getServerWithMeta()
getRegionServerThreads()
of HRS carrying regionName. Returns -1 if none found.public int getServerWith(byte[] regionName)
regionName
- Name of the region in bytesgetRegionServerThreads()
of HRS carrying hbase:meta. Returns -1 if none found.public ServerName getServerHoldingRegion(TableName tn, byte[] regionName) throws IOException
org.apache.hadoop.hbase.HBaseCluster
getServerHoldingRegion
in class HBaseCluster
tn
- Table name that has the region.regionName
- Name of the region in bytesIOException
public long countServedRegions()
public void killAll()
public void waitUntilShutDown()
org.apache.hadoop.hbase.HBaseCluster
waitUntilShutDown
in class HBaseCluster
public List<HRegion> findRegionsForTable(TableName tableName)
protected int getRegionServerIndex(ServerName serverName)
protected int getMasterIndex(ServerName serverName)
public org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService.BlockingInterface getAdminProtocol(ServerName serverName) throws IOException
org.apache.hadoop.hbase.HBaseCluster
getAdminProtocol
in class HBaseCluster
IOException
public org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService.BlockingInterface getClientProtocol(ServerName serverName) throws IOException
org.apache.hadoop.hbase.HBaseCluster
getClientProtocol
in class HBaseCluster
IOException
Copyright © 2007–2019 Cloudera. All rights reserved.