HBASE-20130 Use defaults (16020 & 16030) as base ports when the RS is bound to localhost

Base ports are changed to defaults 16020 & 16030 when RS binds to localhost. This is mostly used in pseudo distributed mode.
This commit is contained in:
Umesh Agashe 2018-03-26 12:10:27 -07:00 committed by Michael Stack
parent b30ff8196a
commit a73f4d84a0
3 changed files with 13 additions and 9 deletions

View File

@ -18,7 +18,11 @@
# */ # */
# This is used for starting multiple regionservers on the same machine. # This is used for starting multiple regionservers on the same machine.
# run it from hbase-dir/ just like 'bin/hbase' # run it from hbase-dir/ just like 'bin/hbase'
# Supports up to 100 regionservers (limitation = overlapping ports) # 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
bin=`dirname "${BASH_SOURCE-$0}"` bin=`dirname "${BASH_SOURCE-$0}"`
bin=`cd "$bin" >/dev/null && pwd` bin=`cd "$bin" >/dev/null && pwd`
@ -44,8 +48,8 @@ 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 16200 + $DN` \ -Dhbase.regionserver.port=`expr $HBASE_RS_BASE_PORT + $DN` \
-Dhbase.regionserver.info.port=`expr 16300 + $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}" \

View File

@ -60,8 +60,8 @@ fi
regionservers=`cat "$HOSTLIST"` regionservers=`cat "$HOSTLIST"`
if [ "$regionservers" = "localhost" ]; then if [ "$regionservers" = "localhost" ]; then
HBASE_REGIONSERVER_ARGS="\ HBASE_REGIONSERVER_ARGS="\
-Dhbase.regionserver.port=16201 \ -Dhbase.regionserver.port=16020 \
-Dhbase.regionserver.info.port=16301" -Dhbase.regionserver.info.port=16030"
$"${@// /\\ }" ${HBASE_REGIONSERVER_ARGS} \ $"${@// /\\ }" ${HBASE_REGIONSERVER_ARGS} \
2>&1 | sed "s/^/$regionserver: /" & 2>&1 | sed "s/^/$regionserver: /" &

View File

@ -392,10 +392,10 @@ Running multiple HRegionServers on the same system can be useful for testing in
The `local-regionservers.sh` command allows you to run multiple RegionServers. 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.
However, the base ports for additional RegionServers are not the default ports since the default ports are used by the HMaster, which is also a RegionServer since HBase version 1.0.0. 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.
The base ports are 16200 and 16300 instead. For supporting additional RegionServers, base ports can be changed in script 'local-regionservers.sh' to appropriate value.
You can run 99 additional RegionServers that are not a HMaster or backup HMaster, 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 16202/16302 (base ports 16200/16300 plus 2). The following command starts four additional RegionServers, running on sequential ports starting at 16022/16032 (base ports 16020/16030 plus 2).
+ +
---- ----