Package org.apache.hadoop.hbase.util
Class ProcessBasedLocalHBaseCluster
java.lang.Object
org.apache.hadoop.hbase.util.ProcessBasedLocalHBaseCluster
A helper class for process-based mini-cluster tests. Unlike
MiniHBaseCluster, starts
daemons as separate processes, allowing to do real kill testing.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classprivate static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.apache.hadoop.conf.Configurationprivate org.apache.hadoop.hdfs.MiniDFSClusterprivate Stringprivate final Stringprivate static final org.slf4j.Loggerprivate static final Patternprivate Threadprivate static final intprivate final intprivate final intprivate final intprivate booleanprivate HBaseTestingUtilityprivate static final Patternprivate final Stringprivate final int -
Constructor Summary
ConstructorsConstructorDescriptionProcessBasedLocalHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numDataNodes, int numRegionServers) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidprivate voidexecuteCommand(String command) private voidexecuteCommand(String command, Map<String, String> envOverrides) private final StringgenerateConfig(ProcessBasedLocalHBaseCluster.ServerType serverType, int rpcPort, String daemonDir) org.apache.hadoop.conf.ConfigurationgetConf()private intgetServerPID(ProcessBasedLocalHBaseCluster.ServerType serverType, int port) voidprivate voidkillProcess(int pid) voidkillRegionServer(int port) private voidkillServer(ProcessBasedLocalHBaseCluster.ServerType serverType, int port) private StringpidFilePath(ProcessBasedLocalHBaseCluster.ServerType serverType, int port) private static StringprocessLine(String line) private static intreadPidFromFile(String pidFile) private static voidreportWebUIPort(String daemon, int port) private StringserverWorkingDir(ProcessBasedLocalHBaseCluster.ServerType serverType, int port) voidshutdown()private voidsortedPorts(int n) Generates a list of random port numbers in the sorted order.private voidvoidvoidstartMaster(int port) voidMakes this local HBase cluster use a mini-DFS cluster.voidstartRegionServer(int port) private voidstartServer(ProcessBasedLocalHBaseCluster.ServerType serverType, int rsPort) voidstartZK()private voidwriteStringToFile(String s, String fileName)
-
Field Details
-
hbaseHome
-
workDir
-
conf
-
numMasters
-
numRegionServers
-
numDataNodes
-
rsPorts
-
masterPorts
-
zkClientPort
-
MAX_FILE_SIZE_OVERRIDE
- See Also:
-
LOG
-
daemonPidFiles
-
shutdownHookInstalled
-
hbaseDaemonScript
-
dfsCluster
-
testUtil
-
logTailerThread
-
logTailDirs
-
TO_REMOVE_FROM_LOG_LINES_RE
-
LOG_PATH_FORMAT_RE
-
-
Constructor Details
-
ProcessBasedLocalHBaseCluster
public ProcessBasedLocalHBaseCluster(org.apache.hadoop.conf.Configuration conf, int numDataNodes, int numRegionServers) Constructor. Modifies the passed configuration.- Parameters:
conf- theConfigurationto usenumDataNodes- the number of data nodesnumRegionServers- the number of region servers
-
-
Method Details
-
startMiniDFS
Makes this local HBase cluster use a mini-DFS cluster. Must be called beforestartHBase().- Throws:
Exception
-
sortedPorts
Generates a list of random port numbers in the sorted order. A sorted order makes sense if we ever want to refer to these servers by their index in the returned array, e.g. server #0, #1, etc. -
startHBase
- Throws:
IOException
-
startRegionServer
-
startMaster
-
killRegionServer
- Throws:
IOException
-
killMaster
- Throws:
IOException
-
startZK
-
executeCommand
-
executeCommand
-
shutdownAllProcesses
-
ensureShutdownHookInstalled
-
cleanupOldState
-
writeStringToFile
-
serverWorkingDir
-
getServerPID
private int getServerPID(ProcessBasedLocalHBaseCluster.ServerType serverType, int port) throws IOException - Throws:
IOException
-
readPidFromFile
- Throws:
IOException
-
pidFilePath
-
killServer
private void killServer(ProcessBasedLocalHBaseCluster.ServerType serverType, int port) throws IOException - Throws:
IOException
-
killProcess
-
startServer
-
generateConfig
private final String generateConfig(ProcessBasedLocalHBaseCluster.ServerType serverType, int rpcPort, String daemonDir) -
reportWebUIPort
-
getConf
-
shutdown
-
processLine
-
startDaemonLogTailer
-