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 <stack@apache.org>
Signed-off-by: Chia-Ping Tsai <chia7712@gmail.com>
Signed-off-by: Sean Busbey <busbey@apache.org>
This commit is contained in:
Umesh Agashe 2018-03-27 13:47:31 -07:00 committed by Sean Busbey
parent 5712fd0451
commit f4fe0521a9
2 changed files with 14 additions and 10 deletions

View File

@ -21,8 +21,12 @@
# Supports up to 10 regionservers (limitation = overlapping ports) # Supports up to 10 regionservers (limitation = overlapping ports)
# For supporting more instances select different values (e.g. 16200, 16300) # For supporting more instances select different values (e.g. 16200, 16300)
# for HBASE_RS_BASE_PORT and HBASE_RS_INFO_BASE_PORT below # for HBASE_RS_BASE_PORT and HBASE_RS_INFO_BASE_PORT below
HBASE_RS_BASE_PORT=16020 if [ -z "$HBASE_RS_BASE_PORT" ]; then
HBASE_RS_INFO_BASE_PORT=16030 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=`dirname "${BASH_SOURCE-$0}"`
bin=`cd "$bin" >/dev/null && pwd` bin=`cd "$bin" >/dev/null && pwd`
@ -48,22 +52,22 @@ run_regionserver () {
DN=$2 DN=$2
export HBASE_IDENT_STRING="$USER-$DN" export HBASE_IDENT_STRING="$USER-$DN"
HBASE_REGIONSERVER_ARGS="\ HBASE_REGIONSERVER_ARGS="\
-Dhbase.regionserver.port=`expr $HBASE_RS_BASE_PORT + $DN` \ -Dhbase.regionserver.port=`expr "$HBASE_RS_BASE_PORT" + "$DN"` \
-Dhbase.regionserver.info.port=`expr $HBASE_RS_INFO_BASE_PORT + $DN`" -Dhbase.regionserver.info.port=`expr "$HBASE_RS_INFO_BASE_PORT" + "$DN"`"
"$bin"/hbase-daemon.sh --config "${HBASE_CONF_DIR}" \ "$bin"/hbase-daemon.sh --config "${HBASE_CONF_DIR}" \
--autostart-window-size "${AUTOSTART_WINDOW_SIZE}" \ --autostart-window-size "${AUTOSTART_WINDOW_SIZE}" \
--autostart-window-retry-limit "${AUTOSTART_WINDOW_RETRY_LIMIT}" \ --autostart-window-retry-limit "${AUTOSTART_WINDOW_RETRY_LIMIT}" \
$1 regionserver $HBASE_REGIONSERVER_ARGS "$1" regionserver "$HBASE_REGIONSERVER_ARGS"
} }
cmd=$1 cmd=$1
shift; shift;
for i in $* for i in "$@"
do do
if [[ "$i" =~ ^[0-9]+$ ]]; then if [[ "$i" =~ ^[0-9]+$ ]]; then
run_regionserver $cmd $i run_regionserver "$cmd" "$i"
else else
echo "Invalid argument" echo "Invalid argument"
fi fi

View File

@ -366,8 +366,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. 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`. 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. 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. 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 16012/16022/16032, 16013/16023/16033, and 16015/16025/16035. The following command starts 3 backup servers using ports 16002/16012, 16003/16013, and 16005/16015.
+ +
---- ----
@ -393,7 +393,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. 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. 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. 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. 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). The following command starts four additional RegionServers, running on sequential ports starting at 16022/16032 (base ports 16020/16030 plus 2).
+ +