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
Modifier and TypeClassDescriptionstatic class
A Monitor super-class can be extended by usersprivate static class
A monitor for region mode.private static class
A monitor for regionserver modestatic class
By RegionServer, for 'regionserver' mode.(package private) static class
Run a single RegionServer Task and then exit.static class
By Region, for 'region' mode.(package private) static class
Run a single Region Task and then exit.static class
Canary region mode-specific data structure which stores information about each region to be scannedstatic interface
Sink interface used by the canary to output informationstatic class
Simple implementation of canary sink that allows plotting to a file or standard output.private static class
static class
Output for 'zookeeper' mode.(package private) static class
Run a single zookeeper Task and then exit. -
Field Summary
Modifier and TypeFieldDescriptionprivate static final String
private org.apache.hadoop.conf.Configuration
This is a Map of table to timeout.private static final long
private static final long
static final TableName
private static final int
private ExecutorService
private static final int
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
private static final int
private long
private static final org.slf4j.Logger
private static final int
private boolean
True if we are to run in 'regionServer' mode.private CanaryTool.Sink
private static final int
private static final int
private boolean
True if we are to run in zookeeper 'mode'. -
Constructor Summary
ConstructorDescriptionCanaryTool
(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 TypeMethodDescriptionint
checkRegions
(String[] targets) Run Canary in Region mode.int
checkRegionServers
(String[] targets) Runs Canary in Region server mode.int
Runs Canary in Zookeeper mode.org.apache.hadoop.conf.Configuration
getConf()
(package private) CanaryTool.Sink
static void
private CanaryTool.Monitor
newMonitor
(Connection connection, String[] monitorTargets) A Factory method forCanaryTool.Monitor
.private int
private void
populateReadTableTimeoutsMap
(String configuredReadTableTimeoutsStr) private void
private void
int
private int
runMonitor
(String[] monitorTargets) void
setConf
(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:Canary
Run Canary in Region mode.- Specified by:
checkRegions
in interfaceCanary
- Parameters:
targets
- -- list of monitor tables.- Returns:
- the exit code of the Canary tool.
- Throws:
Exception
-
checkRegionServers
Description copied from interface:Canary
Runs Canary in Region server mode.- Specified by:
checkRegionServers
in interfaceCanary
- Parameters:
targets
- -- list of monitor tables.- Returns:
- the exit code of the Canary tool.
- Throws:
Exception
-
checkZooKeeper
Description copied from interface:Canary
Runs Canary in Zookeeper mode.- Specified by:
checkZooKeeper
in interfaceCanary
- Returns:
- the exit code of the Canary tool.
- Throws:
Exception
-
getConf
- Specified by:
getConf
in interfaceorg.apache.hadoop.conf.Configurable
-
setConf
- Specified by:
setConf
in interfaceorg.apache.hadoop.conf.Configurable
-
parseArgs
-
run
- Specified by:
run
in interfaceorg.apache.hadoop.util.Tool
- Throws:
Exception
-
runMonitor
- Throws:
Exception
-
getReadFailures
- Specified by:
getReadFailures
in interfaceCanary
-
getWriteFailures
- Specified by:
getWriteFailures
in 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
-