From b1688474d17619c6b9146bb8025189cc148d7d89 Mon Sep 17 00:00:00 2001 From: Zhuoyue Huang <215175212@qq.com> Date: Tue, 31 Mar 2020 09:55:51 +0800 Subject: [PATCH] HBASE-23994:Add WebUI to Canary(Modify code) --- .../java/org/apache/hadoop/hbase/HConstants.java | 6 ------ .../org/apache/hadoop/hbase/tool/CanaryTool.java | 12 +++++++----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java index 4fdaecfb0a22..d518d217ba3b 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java @@ -1464,12 +1464,6 @@ public enum OperationStatusCode { public static final String HBASE_CANARY_READ_RAW_SCAN_KEY = "hbase.canary.read.raw.enabled"; - public static final String HBASE_CANARY_INFO_PORT = "hbase.canary.info.port"; - - public static final int DEFAULT_CANARY_INFOPORT = 16050; - - public static final String HBASE_CANARY_INFO_BINDADDRESS = "hbase.canary.info.bindAddress"; - /** * Configuration keys for programmatic JAAS configuration for secured ZK interaction */ diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java index c4d212c15cc8..b0798ec51a31 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java @@ -19,9 +19,7 @@ package org.apache.hadoop.hbase.tool; -import static org.apache.hadoop.hbase.HConstants.DEFAULT_CANARY_INFOPORT; import static org.apache.hadoop.hbase.HConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT; -import static org.apache.hadoop.hbase.HConstants.HBASE_CANARY_INFO_BINDADDRESS; import static org.apache.hadoop.hbase.HConstants.ZOOKEEPER_ZNODE_PARENT; import java.io.Closeable; @@ -126,6 +124,11 @@ */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.TOOLS) public class CanaryTool implements Tool, Canary { + public static final String HBASE_CANARY_INFO_PORT = "hbase.canary.info.port"; + + public static final int DEFAULT_CANARY_INFOPORT = 16050; + + public static final String HBASE_CANARY_INFO_BINDADDRESS = "hbase.canary.info.bindAddress"; private void putUpWebUI() throws IOException { @@ -135,7 +138,7 @@ private void putUpWebUI() throws IOException { LOG.info("WebUI is not supported in RegionServer mode"); } else { Configuration conf = new Configuration(); - int port = conf.getInt(HConstants.HBASE_CANARY_INFO_PORT, DEFAULT_CANARY_INFOPORT); + int port = conf.getInt(HBASE_CANARY_INFO_PORT, DEFAULT_CANARY_INFOPORT); // -1 is for disabling info server if (port < 0) return; String addr = conf.get(HBASE_CANARY_INFO_BINDADDRESS, "0.0.0.0"); @@ -146,8 +149,7 @@ private void putUpWebUI() throws IOException { infoServer.start(); LOG.info("Bind Canary http info server to port: " + port); } catch (BindException e) { - e.printStackTrace(); - LOG.info("Failed binding Canary http info server to port: " + port); + LOG.warn("Failed binding Canary http info server to port: " + port, e); } } }