1- /**
2- *
1+ /*
32 * Licensed to the Apache Software Foundation (ASF) under one
43 * or more contributor license agreements. See the NOTICE file
54 * distributed with this work for additional information
2120
2221import static org .apache .hadoop .hbase .HConstants .DEFAULT_ZOOKEEPER_ZNODE_PARENT ;
2322import static org .apache .hadoop .hbase .HConstants .ZOOKEEPER_ZNODE_PARENT ;
24-
2523import java .io .Closeable ;
2624import java .io .IOException ;
2725import java .net .BindException ;
5048import java .util .concurrent .atomic .LongAdder ;
5149import java .util .regex .Matcher ;
5250import java .util .regex .Pattern ;
53-
5451import org .apache .commons .lang3 .time .StopWatch ;
5552import org .apache .hadoop .conf .Configuration ;
5653import org .apache .hadoop .hbase .AuthUtil ;
10299import org .apache .zookeeper .data .Stat ;
103100import org .slf4j .Logger ;
104101import org .slf4j .LoggerFactory ;
105-
106102import org .apache .hbase .thirdparty .com .google .common .annotations .VisibleForTesting ;
107103import org .apache .hbase .thirdparty .com .google .common .collect .Lists ;
108104
127123@ InterfaceAudience .LimitedPrivate (HBaseInterfaceAudience .TOOLS )
128124public class CanaryTool implements Tool , Canary {
129125 public static final String HBASE_CANARY_INFO_PORT = "hbase.canary.info.port" ;
130-
131- public static final int DEFAULT_CANARY_INFOPORT = 16050 ;
132-
133126 public static final String HBASE_CANARY_INFO_BINDADDRESS = "hbase.canary.info.bindAddress" ;
134127
135- private InfoServer infoServer ;
136-
137128 private void putUpWebUI () throws IOException {
138- int port = conf .getInt (HBASE_CANARY_INFO_PORT , DEFAULT_CANARY_INFOPORT );
129+ int port = conf .getInt (HBASE_CANARY_INFO_PORT , - 1 );
139130 // -1 is for disabling info server
140131 if (port < 0 ) {
141132 return ;
@@ -147,7 +138,7 @@ private void putUpWebUI() throws IOException {
147138 } else {
148139 String addr = conf .get (HBASE_CANARY_INFO_BINDADDRESS , "0.0.0.0" );
149140 try {
150- infoServer = new InfoServer ("canary" , addr , port , false , conf );
141+ InfoServer infoServer = new InfoServer ("canary" , addr , port , false , conf );
151142 infoServer .addUnprivilegedServlet ("canary" , "/canary-status" , CanaryStatusServlet .class );
152143 infoServer .setAttribute ("sink" , this .sink );
153144 infoServer .start ();
@@ -1114,6 +1105,8 @@ private void printUsageAndExit() {
11141105 System .err .println (" -D<configProperty>=<value> to assign or override configuration params" );
11151106 System .err .println (" -Dhbase.canary.read.raw.enabled=<true/false> Set to enable/disable " +
11161107 "raw scan; default=false" );
1108+ System .err .println (" -Dhbase.canary.info.port=PORT_NUMBER Set for a Canary UI; " +
1109+ "default=-1 (None)" );
11171110 System .err .println ("" );
11181111 System .err .println ("Canary runs in one of three modes: region (default), regionserver, or " +
11191112 "zookeeper." );
0 commit comments