Skip to content

Commit

Permalink
HBASE-23994:Add WebUI to Canary(Modify code)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorryHuang committed Mar 31, 2020
1 parent 2e1cf6a commit b168847
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -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");
Expand All @@ -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);
}
}
}
Expand Down

0 comments on commit b168847

Please sign in to comment.