@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(Configuration conf)
Constructor.
|
LocalHBaseCluster(Configuration conf,
int noRegionServers)
Constructor.
|
LocalHBaseCluster(Configuration conf,
int noMasters,
int noRegionServers)
Constructor.
|
LocalHBaseCluster(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(Configuration c,
int index) |
JVMClusterUtil.MasterThread |
addMaster(Configuration c,
int index,
User user) |
JVMClusterUtil.RegionServerThread |
addRegionServer() |
JVMClusterUtil.RegionServerThread |
addRegionServer(Configuration config,
int index) |
JVMClusterUtil.RegionServerThread |
addRegionServer(Configuration config,
int index,
User user) |
HMaster |
getActiveMaster()
Gets the current active master, if available.
|
Configuration |
getConfiguration() |
List<JVMClusterUtil.MasterThread> |
getLiveMasters() |
List<JVMClusterUtil.RegionServerThread> |
getLiveRegionServers() |
HMaster |
getMaster(int serverNumber) |
List<JVMClusterUtil.MasterThread> |
getMasters() |
HRegionServer |
getRegionServer(int serverNumber) |
List<JVMClusterUtil.RegionServerThread> |
getRegionServers() |
static boolean |
isLocal(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(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(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(Configuration conf) throws IOException
conf
- IOException
public LocalHBaseCluster(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(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(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
public JVMClusterUtil.RegionServerThread addRegionServer() throws IOException
IOException
public JVMClusterUtil.RegionServerThread addRegionServer(Configuration config, int index) throws IOException
IOException
public JVMClusterUtil.RegionServerThread addRegionServer(Configuration config, int index, User user) throws IOException, InterruptedException
IOException
InterruptedException
public JVMClusterUtil.MasterThread addMaster() throws IOException
IOException
public JVMClusterUtil.MasterThread addMaster(Configuration c, int index) throws IOException
IOException
public JVMClusterUtil.MasterThread addMaster(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 Configuration getConfiguration()
public String waitOnRegionServer(int serverNumber)
serverNumber
- public String waitOnRegionServer(JVMClusterUtil.RegionServerThread rst)
rst
- public HMaster getMaster(int serverNumber)
serverNumber
- public HMaster getActiveMaster()
public List<JVMClusterUtil.MasterThread> getMasters()
public List<JVMClusterUtil.MasterThread> getLiveMasters()
public String waitOnMaster(int serverNumber)
serverNumber
- public String waitOnMaster(JVMClusterUtil.MasterThread masterThread)
masterThread
- public void join()
shutdown()
.public void startup() throws IOException
IOException
public void shutdown()
public static boolean isLocal(Configuration c)
c
- Configuration to check.public static void main(String[] args) throws IOException
args
- IOException