@InterfaceAudience.Public @InterfaceStability.Evolving public class LocalHBaseCluster extends Object
startup()
to start the cluster running and shutdown()
to close it all down. join()
the cluster is you want to wait on
shutdown completion.
Runs master on port 16000 by default. Because we can't just kill the process -- not till HADOOP-1700 gets fixed and even then.... -- we need to be able to find the master with a remote client to run shutdown. To use a port other than 16000, set the hbase.master to a value of 'local:PORT': that is 'local', not 'localhost', and the port number the master should use instead of 16000.
Modifier and Type | Field and Description |
---|---|
static String |
LOCAL
local mode
|
static String |
LOCAL_COLON
'local:'
|
Constructor and Description |
---|
LocalHBaseCluster(org.apache.hadoop.conf.Configuration conf)
Constructor.
|
LocalHBaseCluster(org.apache.hadoop.conf.Configuration conf,
int noRegionServers)
Constructor.
|
LocalHBaseCluster(org.apache.hadoop.conf.Configuration conf,
int noMasters,
int noRegionServers)
Constructor.
|
LocalHBaseCluster(org.apache.hadoop.conf.Configuration conf,
int noMasters,
int noRegionServers,
Class<? extends org.apache.hadoop.hbase.master.HMaster> masterClass,
Class<? extends org.apache.hadoop.hbase.regionserver.HRegionServer> regionServerClass)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread |
addMaster() |
org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread |
addMaster(org.apache.hadoop.conf.Configuration c,
int index) |
org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread |
addMaster(org.apache.hadoop.conf.Configuration c,
int index,
User user) |
org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread |
addRegionServer() |
org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread |
addRegionServer(org.apache.hadoop.conf.Configuration config,
int index) |
org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread |
addRegionServer(org.apache.hadoop.conf.Configuration config,
int index,
User user) |
org.apache.hadoop.hbase.master.HMaster |
getActiveMaster()
Gets the current active master, if available.
|
org.apache.hadoop.conf.Configuration |
getConfiguration() |
List<org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread> |
getLiveMasters() |
List<org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread> |
getLiveRegionServers() |
org.apache.hadoop.hbase.master.HMaster |
getMaster(int serverNumber) |
List<org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread> |
getMasters() |
org.apache.hadoop.hbase.regionserver.HRegionServer |
getRegionServer(int serverNumber) |
List<org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread> |
getRegionServers() |
static boolean |
isLocal(org.apache.hadoop.conf.Configuration c) |
void |
join()
Wait for Mini HBase Cluster to shut down.
|
static void |
main(String[] args)
Test things basically work.
|
void |
shutdown()
Shut down the mini HBase cluster
|
void |
startup()
Start the cluster.
|
String |
waitOnMaster(int serverNumber)
Wait for the specified master to stop
Removes this thread from list of running threads.
|
String |
waitOnMaster(org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread masterThread)
Wait for the specified master to stop
Removes this thread from list of running threads.
|
String |
waitOnRegionServer(int serverNumber)
Wait for the specified region server to stop
Removes this thread from list of running threads.
|
String |
waitOnRegionServer(org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread rst)
Wait for the specified region server to stop
Removes this thread from list of running threads.
|
public static final String LOCAL
public static final String LOCAL_COLON
public LocalHBaseCluster(org.apache.hadoop.conf.Configuration conf) throws IOException
conf
- IOException
public LocalHBaseCluster(org.apache.hadoop.conf.Configuration conf, int noRegionServers) throws IOException
conf
- Configuration to use. Post construction has the master's
address.noRegionServers
- Count of regionservers to start.IOException
public LocalHBaseCluster(org.apache.hadoop.conf.Configuration conf, int noMasters, int noRegionServers) throws IOException
conf
- Configuration to use. Post construction has the active master
address.noMasters
- Count of masters to start.noRegionServers
- Count of regionservers to start.IOException
public LocalHBaseCluster(org.apache.hadoop.conf.Configuration conf, int noMasters, int noRegionServers, Class<? extends org.apache.hadoop.hbase.master.HMaster> masterClass, Class<? extends org.apache.hadoop.hbase.regionserver.HRegionServer> regionServerClass) throws IOException
conf
- Configuration to use. Post construction has the master's
address.noMasters
- Count of masters to start.noRegionServers
- Count of regionservers to start.masterClass
- regionServerClass
- IOException
public org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread addRegionServer() throws IOException
IOException
public org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread addRegionServer(org.apache.hadoop.conf.Configuration config, int index) throws IOException
IOException
public org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread addRegionServer(org.apache.hadoop.conf.Configuration config, int index, User user) throws IOException, InterruptedException
IOException
InterruptedException
public org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread addMaster() throws IOException
IOException
public org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread addMaster(org.apache.hadoop.conf.Configuration c, int index) throws IOException
IOException
public org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread addMaster(org.apache.hadoop.conf.Configuration c, int index, User user) throws IOException, InterruptedException
IOException
InterruptedException
public org.apache.hadoop.hbase.regionserver.HRegionServer getRegionServer(int serverNumber)
serverNumber
- public List<org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread> getRegionServers()
public List<org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread> getLiveRegionServers()
public org.apache.hadoop.conf.Configuration getConfiguration()
public String waitOnRegionServer(int serverNumber)
serverNumber
- public String waitOnRegionServer(org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread rst)
rst
- public org.apache.hadoop.hbase.master.HMaster getMaster(int serverNumber)
serverNumber
- public org.apache.hadoop.hbase.master.HMaster getActiveMaster()
public List<org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread> getMasters()
public List<org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread> getLiveMasters()
public String waitOnMaster(int serverNumber)
serverNumber
- public String waitOnMaster(org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread masterThread)
masterThread
- public void join()
shutdown()
.public void startup() throws IOException
IOException
public void shutdown()
public static boolean isLocal(org.apache.hadoop.conf.Configuration c)
c
- Configuration to check.public static void main(String[] args) throws IOException
args
- IOException
Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.