HBASE-20130 (ADDENDUM) Use defaults (16020 & 16030) as base ports when the RS is bound to localhost
* fixed shellcheck errors * modified script to set environment variabless HBASE_RS_BASE_PORT, HBASE_RS_INFO_BASE_PORT to defaults only if its not already set * modified ref guide for default master ports and setting environment variables HBASE_RS_BASE_PORT, HBASE_RS_INFO_BASE_PORT for supporting more than 10 instances for region server on localhost. Signed-off-by: Michael Stack <st...@apache.org> Signed-off-by: Chia-Ping Tsai <chia7...@gmail.com> Signed-off-by: Sean Busbey <bus...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/2e612527 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/2e612527 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/2e612527 Branch: refs/heads/branch-2.0 Commit: 2e612527aab6a10ca154fe95f2eb00e2c348a1f2 Parents: 24f19fd Author: Umesh Agashe <uaga...@cloudera.com> Authored: Tue Mar 27 13:47:31 2018 -0700 Committer: Sean Busbey <bus...@apache.org> Committed: Tue Mar 27 21:26:29 2018 -0500 ---------------------------------------------------------------------- bin/local-regionservers.sh | 18 +++++++++++------- src/main/asciidoc/_chapters/getting_started.adoc | 6 +++--- 2 files changed, 14 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/2e612527/bin/local-regionservers.sh ---------------------------------------------------------------------- diff --git a/bin/local-regionservers.sh b/bin/local-regionservers.sh index 79dc5d0..97e5eed 100755 --- a/bin/local-regionservers.sh +++ b/bin/local-regionservers.sh @@ -21,8 +21,12 @@ # Supports up to 10 regionservers (limitation = overlapping ports) # For supporting more instances select different values (e.g. 16200, 16300) # for HBASE_RS_BASE_PORT and HBASE_RS_INFO_BASE_PORT below -HBASE_RS_BASE_PORT=16020 -HBASE_RS_INFO_BASE_PORT=16030 +if [ -z "$HBASE_RS_BASE_PORT" ]; then + HBASE_RS_BASE_PORT=16020 +fi +if [ -z "$HBASE_RS_INFO_BASE_PORT" ]; then + HBASE_RS_INFO_BASE_PORT=16030 +fi bin=`dirname "${BASH_SOURCE-$0}"` bin=`cd "$bin" >/dev/null && pwd` @@ -48,22 +52,22 @@ run_regionserver () { DN=$2 export HBASE_IDENT_STRING="$USER-$DN" HBASE_REGIONSERVER_ARGS="\ - -Dhbase.regionserver.port=`expr $HBASE_RS_BASE_PORT + $DN` \ - -Dhbase.regionserver.info.port=`expr $HBASE_RS_INFO_BASE_PORT + $DN`" + -Dhbase.regionserver.port=`expr "$HBASE_RS_BASE_PORT" + "$DN"` \ + -Dhbase.regionserver.info.port=`expr "$HBASE_RS_INFO_BASE_PORT" + "$DN"`" "$bin"/hbase-daemon.sh --config "${HBASE_CONF_DIR}" \ --autostart-window-size "${AUTOSTART_WINDOW_SIZE}" \ --autostart-window-retry-limit "${AUTOSTART_WINDOW_RETRY_LIMIT}" \ - $1 regionserver $HBASE_REGIONSERVER_ARGS + "$1" regionserver "$HBASE_REGIONSERVER_ARGS" } cmd=$1 shift; -for i in $* +for i in "$@" do if [[ "$i" =~ ^[0-9]+$ ]]; then - run_regionserver $cmd $i + run_regionserver "$cmd" "$i" else echo "Invalid argument" fi http://git-wip-us.apache.org/repos/asf/hbase/blob/2e612527/src/main/asciidoc/_chapters/getting_started.adoc ---------------------------------------------------------------------- diff --git a/src/main/asciidoc/_chapters/getting_started.adoc b/src/main/asciidoc/_chapters/getting_started.adoc index dae3688..32eb669 100644 --- a/src/main/asciidoc/_chapters/getting_started.adoc +++ b/src/main/asciidoc/_chapters/getting_started.adoc @@ -384,8 +384,8 @@ The HMaster server controls the HBase cluster. You can start up to 9 backup HMaster servers, which makes 10 total HMasters, counting the primary. To start a backup HMaster, use the `local-master-backup.sh`. For each backup master you want to start, add a parameter representing the port offset for that master. -Each HMaster uses three ports (16010, 16020, and 16030 by default). The port offset is added to these ports, so using an offset of 2, the backup HMaster would use ports 16012, 16022, and 16032. -The following command starts 3 backup servers using ports 16012/16022/16032, 16013/16023/16033, and 16015/16025/16035. +Each HMaster uses two ports (16000 and 16010 by default). The port offset is added to these ports, so using an offset of 2, the backup HMaster would use ports 16002 and 16012. +The following command starts 3 backup servers using ports 16002/16012, 16003/16013, and 16005/16015. + ---- @@ -411,7 +411,7 @@ The `local-regionservers.sh` command allows you to run multiple RegionServers. It works in a similar way to the `local-master-backup.sh` command, in that each parameter you provide represents the port offset for an instance. Each RegionServer requires two ports, and the default ports are 16020 and 16030. Since HBase version 1.1.0, HMaster doesn't use region server ports, this leaves 10 ports (16020 to 16029 and 16030 to 16039) to be used for RegionServers. -For supporting additional RegionServers, base ports can be changed in script 'local-regionservers.sh' to appropriate value. +For supporting additional RegionServers, set environment variables HBASE_RS_BASE_PORT and HBASE_RS_INFO_BASE_PORT to appropriate values before running script `local-regionservers.sh`. e.g. With values 16200 and 16300 for base ports, 99 additional RegionServers can be supported, on a server. The following command starts four additional RegionServers, running on sequential ports starting at 16022/16032 (base ports 16020/16030 plus 2). +