@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 |
private org.apache.hadoop.conf.Configuration |
conf |
private static int |
DEFAULT_NO |
static String |
LOCAL
local mode
|
static String |
LOCAL_COLON
'local:'
|
private static org.slf4j.Logger |
LOG |
private Class<? extends HMaster> |
masterClass |
private List<JVMClusterUtil.MasterThread> |
masterThreads |
private Class<? extends HRegionServer> |
regionServerClass |
private List<JVMClusterUtil.RegionServerThread> |
regionThreads |
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 HMaster> masterClass,
Class<? extends HRegionServer> regionServerClass)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
JVMClusterUtil.MasterThread |
addMaster() |
JVMClusterUtil.MasterThread |
addMaster(org.apache.hadoop.conf.Configuration c,
int index) |
JVMClusterUtil.MasterThread |
addMaster(org.apache.hadoop.conf.Configuration c,
int index,
User user) |
JVMClusterUtil.RegionServerThread |
addRegionServer() |
JVMClusterUtil.RegionServerThread |
addRegionServer(org.apache.hadoop.conf.Configuration config,
int index) |
JVMClusterUtil.RegionServerThread |
addRegionServer(org.apache.hadoop.conf.Configuration config,
int index,
User user) |
HMaster |
getActiveMaster()
Gets the current active master, if available.
|
org.apache.hadoop.conf.Configuration |
getConfiguration() |
List<JVMClusterUtil.MasterThread> |
getLiveMasters() |
List<JVMClusterUtil.RegionServerThread> |
getLiveRegionServers() |
HMaster |
getMaster(int serverNumber) |
private static Class<? extends HMaster> |
getMasterImplementation(org.apache.hadoop.conf.Configuration conf) |
List<JVMClusterUtil.MasterThread> |
getMasters() |
HRegionServer |
getRegionServer(int serverNumber) |
private static Class<? extends HRegionServer> |
getRegionServerImplementation(org.apache.hadoop.conf.Configuration conf) |
List<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(JVMClusterUtil.MasterThread masterThread)
Wait for the specified master to stop.
|
String |
waitOnRegionServer(int serverNumber)
Wait for the specified region server to stop.
|
String |
waitOnRegionServer(JVMClusterUtil.RegionServerThread rst)
Wait for the specified region server to stop.
|
private static final org.slf4j.Logger LOG
private final List<JVMClusterUtil.MasterThread> masterThreads
private final List<JVMClusterUtil.RegionServerThread> regionThreads
private static final int DEFAULT_NO
public static final String LOCAL
public static final String LOCAL_COLON
public static final String ASSIGN_RANDOM_PORTS
private final org.apache.hadoop.conf.Configuration conf
private final Class<? extends HMaster> masterClass
private final Class<? extends HRegionServer> regionServerClass
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 HMaster> masterClass, Class<? extends 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
private static Class<? extends HRegionServer> getRegionServerImplementation(org.apache.hadoop.conf.Configuration conf)
private static Class<? extends HMaster> getMasterImplementation(org.apache.hadoop.conf.Configuration conf)
public JVMClusterUtil.RegionServerThread addRegionServer() throws IOException
IOException
public JVMClusterUtil.RegionServerThread addRegionServer(org.apache.hadoop.conf.Configuration config, int index) throws IOException
IOException
public JVMClusterUtil.RegionServerThread addRegionServer(org.apache.hadoop.conf.Configuration config, int index, User user) throws IOException, InterruptedException
IOException
InterruptedException
public JVMClusterUtil.MasterThread addMaster() throws IOException
IOException
public JVMClusterUtil.MasterThread addMaster(org.apache.hadoop.conf.Configuration c, int index) throws IOException
IOException
public JVMClusterUtil.MasterThread addMaster(org.apache.hadoop.conf.Configuration c, int index, User user) throws IOException, InterruptedException
IOException
InterruptedException
public HRegionServer getRegionServer(int serverNumber)
serverNumber
- public List<JVMClusterUtil.RegionServerThread> getRegionServers()
public List<JVMClusterUtil.RegionServerThread> getLiveRegionServers()
public org.apache.hadoop.conf.Configuration getConfiguration()
public String waitOnRegionServer(int serverNumber)
public String waitOnRegionServer(JVMClusterUtil.RegionServerThread rst)
public HMaster getActiveMaster()
public List<JVMClusterUtil.MasterThread> getMasters()
public List<JVMClusterUtil.MasterThread> getLiveMasters()
public String waitOnMaster(int serverNumber)
public String waitOnMaster(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–2019 The Apache Software Foundation. All rights reserved.