You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/03/26 03:07:13 UTC

[GitHub] [hbase] Apache9 commented on a change in pull request #1292: HBASE-23994:Add WebUI to Canary

Apache9 commented on a change in pull request #1292: HBASE-23994:Add WebUI to Canary
URL: https://github.com/apache/hbase/pull/1292#discussion_r398291625
 
 

 ##########
 File path: hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java
 ##########
 @@ -123,6 +127,31 @@
 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.TOOLS)
 public class CanaryTool implements Tool, Canary {
 
+
+  private void putUpWebUI() throws IOException {
+    if (zookeeperMode) {
+      LOG.info("WebUI is not supported in Zookeeper mode");
+    } else if (regionServerMode) {
+      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);
+      // -1 is for disabling info server
+      if (port < 0) return;
+      String addr = conf.get(HBASE_CANARY_INFO_BINDADDRESS, "0.0.0.0");
+      try {
+        InfoServer infoServer = new InfoServer("canary", addr, port, false, conf);
+        infoServer.addUnprivilegedServlet("canary", "/canary-status", CanaryStatusServlet.class);
+        infoServer.setAttribute("sink", this.sink);
+        infoServer.start();
+        LOG.info("Bind Canary http info server to port: " + port);
+      } catch (BindException e) {
+        e.printStackTrace();
 
 Review comment:
   Avoid using e.printStackTrace directly?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services