public class ProcessBasedLocalHBaseCluster extends Object
MiniHBaseCluster
, starts
daemons as separate processes, allowing to do real kill testing.Modifier and Type | Class and Description |
---|---|
private class |
ProcessBasedLocalHBaseCluster.LocalDaemonLogTailer |
private static class |
ProcessBasedLocalHBaseCluster.ServerType |
Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.conf.Configuration |
conf |
private List<String> |
daemonPidFiles |
private org.apache.hadoop.hdfs.MiniDFSCluster |
dfsCluster |
private String |
hbaseDaemonScript |
private String |
hbaseHome |
private static org.slf4j.Logger |
LOG |
private static Pattern |
LOG_PATH_FORMAT_RE |
private List<String> |
logTailDirs |
private Thread |
logTailerThread |
private List<Integer> |
masterPorts |
private static int |
MAX_FILE_SIZE_OVERRIDE |
private int |
numDataNodes |
private int |
numMasters |
private int |
numRegionServers |
private List<Integer> |
rsPorts |
private boolean |
shutdownHookInstalled |
private HBaseTestingUtility |
testUtil |
private static Pattern |
TO_REMOVE_FROM_LOG_LINES_RE |
private String |
workDir |
private int |
zkClientPort |
Constructor and Description |
---|
ProcessBasedLocalHBaseCluster(org.apache.hadoop.conf.Configuration conf,
int numDataNodes,
int numRegionServers)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
cleanupOldState() |
private void |
ensureShutdownHookInstalled() |
private void |
executeCommand(String command) |
private void |
executeCommand(String command,
Map<String,String> envOverrides) |
private String |
generateConfig(ProcessBasedLocalHBaseCluster.ServerType serverType,
int rpcPort,
String daemonDir) |
org.apache.hadoop.conf.Configuration |
getConf() |
private int |
getServerPID(ProcessBasedLocalHBaseCluster.ServerType serverType,
int port) |
void |
killMaster() |
private void |
killProcess(int pid) |
void |
killRegionServer(int port) |
private void |
killServer(ProcessBasedLocalHBaseCluster.ServerType serverType,
int port) |
private String |
pidFilePath(ProcessBasedLocalHBaseCluster.ServerType serverType,
int port) |
private static String |
processLine(String line) |
private static int |
readPidFromFile(String pidFile) |
private static void |
reportWebUIPort(String daemon,
int port) |
private String |
serverWorkingDir(ProcessBasedLocalHBaseCluster.ServerType serverType,
int port) |
void |
shutdown() |
private void |
shutdownAllProcesses() |
private static List<Integer> |
sortedPorts(int n)
Generates a list of random port numbers in the sorted order.
|
private void |
startDaemonLogTailer() |
void |
startHBase() |
void |
startMaster(int port) |
void |
startMiniDFS()
Makes this local HBase cluster use a mini-DFS cluster.
|
void |
startRegionServer(int port) |
private void |
startServer(ProcessBasedLocalHBaseCluster.ServerType serverType,
int rsPort) |
void |
startZK() |
private void |
writeStringToFile(String s,
String fileName) |
private final org.apache.hadoop.conf.Configuration conf
private final int numMasters
private final int numRegionServers
private final int numDataNodes
private final List<Integer> masterPorts
private final int zkClientPort
private static final int MAX_FILE_SIZE_OVERRIDE
private static final org.slf4j.Logger LOG
private List<String> daemonPidFiles
private boolean shutdownHookInstalled
private String hbaseDaemonScript
private org.apache.hadoop.hdfs.MiniDFSCluster dfsCluster
private HBaseTestingUtility testUtil
private Thread logTailerThread
private List<String> logTailDirs
private static final Pattern TO_REMOVE_FROM_LOG_LINES_RE
private static final Pattern LOG_PATH_FORMAT_RE
public ProcessBasedLocalHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numDataNodes, int numRegionServers)
conf
- the Configuration
to usenumDataNodes
- the number of data nodesnumRegionServers
- the number of region serverspublic void startMiniDFS() throws Exception
startHBase()
. nException
private static List<Integer> sortedPorts(int n)
public void startHBase() throws IOException
IOException
public void startRegionServer(int port)
public void startMaster(int port)
public void killRegionServer(int port) throws IOException
IOException
public void killMaster() throws IOException
IOException
public void startZK()
private void executeCommand(String command)
private void executeCommand(String command, Map<String,String> envOverrides)
private void shutdownAllProcesses()
private void ensureShutdownHookInstalled()
private void cleanupOldState()
private void writeStringToFile(String s, String fileName)
private String serverWorkingDir(ProcessBasedLocalHBaseCluster.ServerType serverType, int port)
private int getServerPID(ProcessBasedLocalHBaseCluster.ServerType serverType, int port) throws IOException
IOException
private static int readPidFromFile(String pidFile) throws IOException
IOException
private String pidFilePath(ProcessBasedLocalHBaseCluster.ServerType serverType, int port)
private void killServer(ProcessBasedLocalHBaseCluster.ServerType serverType, int port) throws IOException
IOException
private void killProcess(int pid)
private void startServer(ProcessBasedLocalHBaseCluster.ServerType serverType, int rsPort)
private final String generateConfig(ProcessBasedLocalHBaseCluster.ServerType serverType, int rpcPort, String daemonDir)
private static void reportWebUIPort(String daemon, int port)
public org.apache.hadoop.conf.Configuration getConf()
public void shutdown()
private static String processLine(String line)
private void startDaemonLogTailer()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.