Package org.apache.hadoop.hbase.tool
Class CanaryTool
java.lang.Object
org.apache.hadoop.hbase.tool.CanaryTool
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable,Canary,org.apache.hadoop.util.Tool
@LimitedPrivate("Tools")
public class CanaryTool
extends Object
implements org.apache.hadoop.util.Tool, Canary
HBase Canary Tool for "canary monitoring" of a running HBase cluster. There are three modes:
- region mode (Default): For each region, try to get one row per column family outputting information on failure (ERROR) or else the latency.
- regionserver mode: For each regionserver try to get one row from one table selected randomly outputting information on failure (ERROR) or else the latency.
- zookeeper mode: for each zookeeper instance, selects a znode outputting information on failure (ERROR) or else the latency.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA Monitor super-class can be extended by usersprivate static classA monitor for region mode.private static classA monitor for regionserver modestatic classBy RegionServer, for 'regionserver' mode.(package private) static classRun a single RegionServer Task and then exit.static classBy Region, for 'region' mode.(package private) static classRun a single Region Task and then exit.static classCanary region mode-specific data structure which stores information about each region to be scannedstatic interfaceSink interface used by the canary to output informationstatic classSimple implementation of canary sink that allows plotting to a file or standard output.private static classstatic classOutput for 'zookeeper' mode.(package private) static classRun a single zookeeper Task and then exit. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate org.apache.hadoop.conf.ConfigurationThis is a Map of table to timeout.private static final longprivate static final longstatic final TableNameprivate static final intprivate ExecutorServiceprivate static final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprivate static final intprivate longprivate static final org.slf4j.Loggerprivate static final intprivate booleanTrue if we are to run in 'regionServer' mode.private CanaryTool.Sinkprivate static final intprivate static final intprivate booleanTrue if we are to run in zookeeper 'mode'. -
Constructor Summary
ConstructorsConstructorDescriptionCanaryTool(ExecutorService executor) CanaryTool(ExecutorService executor, CanaryTool.Sink sink) CanaryTool(org.apache.hadoop.conf.Configuration conf, ExecutorService executor) CanaryTool(org.apache.hadoop.conf.Configuration conf, ExecutorService executor, CanaryTool.Sink sink) -
Method Summary
Modifier and TypeMethodDescriptionintcheckRegions(String[] targets) Run Canary in Region mode.intcheckRegionServers(String[] targets) Runs Canary in Region server mode.intRuns Canary in Zookeeper mode.org.apache.hadoop.conf.ConfigurationgetConf()(package private) CanaryTool.Sinkstatic voidprivate CanaryTool.MonitornewMonitor(Connection connection, String[] monitorTargets) A Factory method forCanaryTool.Monitor.private intprivate voidpopulateReadTableTimeoutsMap(String configuredReadTableTimeoutsStr) private voidprivate voidintprivate intrunMonitor(String[] monitorTargets) voidsetConf(org.apache.hadoop.conf.Configuration conf) sniff(Admin admin, CanaryTool.Sink sink, String tableName, ExecutorService executor, CanaryTool.RegionTask.TaskType taskType, boolean rawScanEnabled, LongAdder readLatency, boolean readAllCF) Canary entry point for specified table.sniff(Admin admin, CanaryTool.Sink sink, TableDescriptor tableDesc, ExecutorService executor, CanaryTool.RegionTask.TaskType taskType, boolean rawScanEnabled, LongAdder rwLatency, boolean readAllCF)
-
Field Details
-
HBASE_CANARY_INFO_PORT
- See Also:
-
HBASE_CANARY_INFO_BINDADDRESS
- See Also:
-
USAGE_EXIT_CODE
- See Also:
-
INIT_ERROR_EXIT_CODE
- See Also:
-
TIMEOUT_ERROR_EXIT_CODE
- See Also:
-
ERROR_EXIT_CODE
- See Also:
-
FAILURE_EXIT_CODE
- See Also:
-
DEFAULT_INTERVAL
- See Also:
-
DEFAULT_TIMEOUT
- See Also:
-
MAX_THREADS_NUM
- See Also:
-
LOG
-
DEFAULT_WRITE_TABLE_NAME
-
CANARY_TABLE_FAMILY_NAME
- See Also:
-
conf
-
interval
-
sink
-
regionServerMode
True if we are to run in 'regionServer' mode. -
zookeeperMode
True if we are to run in zookeeper 'mode'. -
configuredReadTableTimeouts
This is a Map of table to timeout. The timeout is for reading all regions in the table; i.e. we aggregate time to fetch each region and it needs to be less than this value else we log an ERROR. -
HBASE_CANARY_REGIONSERVER_ALL_REGIONS
- See Also:
-
HBASE_CANARY_REGION_WRITE_SNIFFING
- See Also:
-
HBASE_CANARY_REGION_WRITE_TABLE_TIMEOUT
- See Also:
-
HBASE_CANARY_REGION_WRITE_TABLE_NAME
- See Also:
-
HBASE_CANARY_REGION_READ_TABLE_TIMEOUT
- See Also:
-
HBASE_CANARY_ZOOKEEPER_PERMITTED_FAILURES
- See Also:
-
HBASE_CANARY_USE_REGEX
- See Also:
-
HBASE_CANARY_TIMEOUT
- See Also:
-
HBASE_CANARY_FAIL_ON_ERROR
- See Also:
-
executor
-
-
Constructor Details
-
CanaryTool
public CanaryTool() -
CanaryTool
-
CanaryTool
-
CanaryTool
CanaryTool(org.apache.hadoop.conf.Configuration conf, ExecutorService executor) -
CanaryTool
CanaryTool(org.apache.hadoop.conf.Configuration conf, ExecutorService executor, CanaryTool.Sink sink)
-
-
Method Details
-
putUpWebUI
- Throws:
IOException
-
checkRegions
Description copied from interface:CanaryRun Canary in Region mode.- Specified by:
checkRegionsin interfaceCanary- Parameters:
targets- -- list of monitor tables.- Returns:
- the exit code of the Canary tool.
- Throws:
Exception
-
checkRegionServers
Description copied from interface:CanaryRuns Canary in Region server mode.- Specified by:
checkRegionServersin interfaceCanary- Parameters:
targets- -- list of monitor tables.- Returns:
- the exit code of the Canary tool.
- Throws:
Exception
-
checkZooKeeper
Description copied from interface:CanaryRuns Canary in Zookeeper mode.- Specified by:
checkZooKeeperin interfaceCanary- Returns:
- the exit code of the Canary tool.
- Throws:
Exception
-
getConf
- Specified by:
getConfin interfaceorg.apache.hadoop.conf.Configurable
-
setConf
- Specified by:
setConfin interfaceorg.apache.hadoop.conf.Configurable
-
parseArgs
-
run
- Specified by:
runin interfaceorg.apache.hadoop.util.Tool- Throws:
Exception
-
runMonitor
- Throws:
Exception
-
getReadFailures
- Specified by:
getReadFailuresin interfaceCanary
-
getWriteFailures
- Specified by:
getWriteFailuresin interfaceCanary
-
printUsageAndExit
-
getSink
-
newMonitor
A Factory method forCanaryTool.Monitor. Makes a RegionServerMonitor, or a ZooKeeperMonitor, or a RegionMonitor.- Returns:
- a Monitor instance
-
populateReadTableTimeoutsMap
-
sniff
private static List<Future<Void>> sniff(Admin admin, CanaryTool.Sink sink, String tableName, ExecutorService executor, CanaryTool.RegionTask.TaskType taskType, boolean rawScanEnabled, LongAdder readLatency, boolean readAllCF) throws Exception Canary entry point for specified table.- Throws:
Exception- exception
-
sniff
private static List<Future<Void>> sniff(Admin admin, CanaryTool.Sink sink, TableDescriptor tableDesc, ExecutorService executor, CanaryTool.RegionTask.TaskType taskType, boolean rawScanEnabled, LongAdder rwLatency, boolean readAllCF) throws Exception - Throws:
Exception
-
main
- Throws:
Exception
-