HBASE-24671 Add excludefile and designatedfile options to graceful_stop.sh
Closes #2013 Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
parent
a7a0e1a596
commit
fe2ae809d1
|
@ -22,7 +22,8 @@
|
|||
# Turn off the balancer before running this script.
|
||||
function usage {
|
||||
echo "Usage: graceful_stop.sh [--config <conf-dir>] [-e] [--restart [--reload]] [--thrift] \
|
||||
[--rest] [-nob |--nobalancer ] <hostname>"
|
||||
[--rest] [-n |--noack] [--maxthreads <number of threads>] [--movetimeout <timeout in seconds>] \
|
||||
[-nob |--nobalancer] [-d |--designatedfile <file path>] [-x |--excludefile <file path>] <hostname>"
|
||||
echo " thrift If we should stop/start thrift before/after the hbase stop/start"
|
||||
echo " rest If we should stop/start rest before/after the hbase stop/start"
|
||||
echo " restart If we should restart after graceful stop"
|
||||
|
@ -34,8 +35,11 @@ moving regions"
|
|||
exit with error. Default value is INT_MAX."
|
||||
echo " hostname Hostname of server we are to stop"
|
||||
echo " e|failfast Set -e so exit immediately if any command exits with non-zero status"
|
||||
echo " nob| nobalancer Do not manage balancer states. This is only used as optimization in \
|
||||
echo " nob|nobalancer Do not manage balancer states. This is only used as optimization in \
|
||||
rolling_restart.sh to avoid multiple calls to hbase shell"
|
||||
echo " d|designatedfile xx Designated file with <hostname:port> per line as unload targets"
|
||||
echo " x|excludefile xx Exclude file should have <hostname:port> per line. We do not unload \
|
||||
regions to hostnames given in exclude file"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -57,6 +61,8 @@ movetimeout=2147483647
|
|||
maxthreads=1
|
||||
failfast=
|
||||
nob=false
|
||||
designatedfile=
|
||||
excludefile=
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
|
@ -69,6 +75,8 @@ do
|
|||
--maxthreads) shift; maxthreads=$1; shift;;
|
||||
--movetimeout) shift; movetimeout=$1; shift;;
|
||||
--nobalancer | -nob) nob=true; shift;;
|
||||
--designatedfile | -d) shift; designatedfile=$1; shift;;
|
||||
--excludefile | -x) shift; excludefile=$1; shift;;
|
||||
--) shift; break;;
|
||||
-*) usage ;;
|
||||
*) break;; # terminate while loop
|
||||
|
@ -110,10 +118,20 @@ else
|
|||
log "Previous balancer state was $HBASE_BALANCER_STATE"
|
||||
fi
|
||||
|
||||
unload_args="--filename $filename --maxthreads $maxthreads $noack --operation unload \
|
||||
--timeout $movetimeout --regionserverhost $hostname"
|
||||
|
||||
if [ "$designatedfile" != "" ]; then
|
||||
unload_args="$unload_args --designatedfile $designatedfile"
|
||||
fi
|
||||
|
||||
if [ "$excludefile" != "" ]; then
|
||||
unload_args="$unload_args --excludefile $excludefile"
|
||||
fi
|
||||
|
||||
log "Unloading $hostname region(s)"
|
||||
HBASE_NOEXEC=true "$bin"/hbase --config ${HBASE_CONF_DIR} org.apache.hadoop.hbase.util.RegionMover \
|
||||
--filename $filename --maxthreads $maxthreads $noack --operation "unload" --timeout $movetimeout \
|
||||
--regionserverhost $hostname
|
||||
$unload_args
|
||||
log "Unloaded $hostname region(s)"
|
||||
|
||||
# Stop the server(s). Have to put hostname into its own little file for hbase-daemons.sh
|
||||
|
|
|
@ -1385,13 +1385,19 @@ Here is its usage:
|
|||
|
||||
----
|
||||
$ ./bin/graceful_stop.sh
|
||||
Usage: graceful_stop.sh [--config &conf-dir>] [--restart] [--reload] [--thrift] [--rest] &hostname>
|
||||
thrift If we should stop/start thrift before/after the hbase stop/start
|
||||
rest If we should stop/start rest before/after the hbase stop/start
|
||||
restart If we should restart after graceful stop
|
||||
reload Move offloaded regions back on to the stopped server
|
||||
debug Move offloaded regions back on to the stopped server
|
||||
hostname Hostname of server we are to stop
|
||||
Usage: graceful_stop.sh [--config <conf-dir>] [-e] [--restart [--reload]] [--thrift] [--rest] [-n |--noack] [--maxthreads <number of threads>] [--movetimeout <timeout in seconds>] [-nob |--nobalancer] [-d |--designatedfile <file path>] [-x |--excludefile <file path>] <hostname>
|
||||
thrift If we should stop/start thrift before/after the hbase stop/start
|
||||
rest If we should stop/start rest before/after the hbase stop/start
|
||||
restart If we should restart after graceful stop
|
||||
reload Move offloaded regions back on to the restarted server
|
||||
n|noack Enable noAck mode in RegionMover. This is a best effort mode for moving regions
|
||||
maxthreads xx Limit the number of threads used by the region mover. Default value is 1.
|
||||
movetimeout xx Timeout for moving regions. If regions are not moved by the timeout value,exit with error. Default value is INT_MAX.
|
||||
hostname Hostname of server we are to stop
|
||||
e|failfast Set -e so exit immediately if any command exits with non-zero status
|
||||
nob|nobalancer Do not manage balancer states. This is only used as optimization in rolling_restart.sh to avoid multiple calls to hbase shell
|
||||
d|designatedfile xx Designated file with <hostname:port> per line as unload targets
|
||||
x|excludefile xx Exclude file should have <hostname:port> per line. We do not unload regions to hostnames given in exclude file
|
||||
----
|
||||
|
||||
To decommission a loaded RegionServer, run the following: +$
|
||||
|
|
Loading…
Reference in New Issue