@InterfaceAudience.Public 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 |
ASSIGN_RANDOM_PORTS |
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) |
LocalHBaseCluster(org.apache.hadoop.conf.Configuration conf,
int noMasters,
int noAlwaysStandByMasters,
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.
|
String |
waitOnMaster(org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread masterThread)
Wait for the specified master to stop.
|
String |
waitOnRegionServer(int serverNumber)
Wait for the specified region server to stop.
|
String |
waitOnRegionServer(org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread rst)
Wait for the specified region server to stop.
|
public static final String LOCAL
public static final String LOCAL_COLON
public static final String ASSIGN_RANDOM_PORTS
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
IOException
public LocalHBaseCluster(org.apache.hadoop.conf.Configuration conf, int noMasters, int noAlwaysStandByMasters, 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)
public String waitOnRegionServer(org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread rst)
public org.apache.hadoop.hbase.master.HMaster getMaster(int 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)
public String waitOnMaster(org.apache.hadoop.hbase.util.JVMClusterUtil.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–2020 The Apache Software Foundation. All rights reserved.