From bab812df289a3bb33407446a8910e3bb5c6195e0 Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Tue, 9 Feb 2016 22:45:37 -0800 Subject: [PATCH] HBASE-15216 Canary does not accept config params from command line (Vishal Khandelwal) --- .../main/java/org/apache/hadoop/hbase/tool/Canary.java | 9 +++++++++ src/main/asciidoc/_chapters/ops_mgt.adoc | 1 + 2 files changed, 10 insertions(+) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java index 151be425297..837688e8f6e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java @@ -76,6 +76,7 @@ import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.apache.hadoop.hbase.util.Pair; import org.apache.hadoop.hbase.util.ReflectionUtils; import org.apache.hadoop.hbase.util.RegionSplitter; +import org.apache.hadoop.util.GenericOptionsParser; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; @@ -640,6 +641,8 @@ public final class Canary implements Tool { System.err.println(" -writeSniffing enable the write sniffing in canary"); System.err.println(" -writeTable The table used for write sniffing." + " Default is hbase:canary"); + System.err + .println(" -D= assigning or override the configuration params"); System.exit(USAGE_EXIT_CODE); } @@ -1184,7 +1187,13 @@ public final class Canary implements Tool { public static void main(String[] args) throws Exception { final Configuration conf = HBaseConfiguration.create(); + + // loading the generic options to conf + new GenericOptionsParser(conf, args); + int numThreads = conf.getInt("hbase.canary.threads.num", MAX_THREADS_NUM); + LOG.info("Number of exection threads " + numThreads); + ExecutorService executor = new ScheduledThreadPoolExecutor(numThreads); Class sinkClass = diff --git a/src/main/asciidoc/_chapters/ops_mgt.adoc b/src/main/asciidoc/_chapters/ops_mgt.adoc index 13835c08277..0f937855ba9 100644 --- a/src/main/asciidoc/_chapters/ops_mgt.adoc +++ b/src/main/asciidoc/_chapters/ops_mgt.adoc @@ -94,6 +94,7 @@ Usage: bin/hbase org.apache.hadoop.hbase.tool.Canary [opts] [table1 [table2]...] -t timeout for a check, default is 600000 (milliseconds) -writeSniffing enable the write sniffing in canary -writeTable The table used for write sniffing. Default is hbase:canary + -D= assigning or override the configuration params ---- This tool will return non zero error codes to user for collaborating with other monitoring tools, such as Nagios.