HBASE-3748 Add rolling of thrift/rest daemons to graceful_stop.sh script

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1089666 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-04-06 23:14:01 +00:00
parent 0c69352818
commit 803a91646c
2 changed files with 21 additions and 1 deletions

View File

@ -141,6 +141,7 @@ Release 0.91.0 - Unreleased
HBASE-3573 Move shutdown messaging OFF hearbeat; prereq for fix of HBASE-3573 Move shutdown messaging OFF hearbeat; prereq for fix of
hbase-1502 hbase-1502
HBASE-3071 Graceful decommissioning of a regionserver HBASE-3071 Graceful decommissioning of a regionserver
HBASE-3748 Add rolling of thrift/rest daemons to graceful_stop.sh script
NEW FEATURES NEW FEATURES

View File

@ -23,7 +23,9 @@
# Move regions off a server then stop it. Optionally restart and reload. # Move regions off a server then stop it. Optionally restart and reload.
# Turn off the balancer before running this script. # Turn off the balancer before running this script.
function usage { function usage {
echo "Usage: graceful_stop.sh [--config <conf-dir>] [--restart] [--reload] <hostname>" echo "Usage: graceful_stop.sh [--config <conf-dir>] [--restart] [--reload] [--thrift] [--rest] <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" echo " restart If we should restart after graceful stop"
echo " reload Move offloaded regions back on to the stopped server" echo " reload Move offloaded regions back on to the stopped server"
echo " debug Move offloaded regions back on to the stopped server" echo " debug Move offloaded regions back on to the stopped server"
@ -43,9 +45,13 @@ bin=`cd "$bin">/dev/null; pwd`
restart= restart=
reload= reload=
debug= debug=
thrift=
rest=
while [ $# -gt 0 ] while [ $# -gt 0 ]
do do
case "$1" in case "$1" in
--thrift) thrift=true; shift;;
--rest) rest=true; shift;;
--restart) restart=true; shift;; --restart) restart=true; shift;;
--reload) reload=true; shift;; --reload) reload=true; shift;;
--debug) debug="--debug"; shift;; --debug) debug="--debug"; shift;;
@ -69,9 +75,22 @@ echo "Unloaded $hostname region(s)"
# Stop the server. Have to put hostname into its own little file for hbase-daemons.sh # Stop the server. Have to put hostname into its own little file for hbase-daemons.sh
hosts="/tmp/$(basename $0).$$.tmp" hosts="/tmp/$(basename $0).$$.tmp"
echo $hostname >> $hosts echo $hostname >> $hosts
if [ "$thrift" != "" ]; then
"$bin"/hbase-daemons.sh --hosts ${hosts} stop thrift
fi
if [ "$rest" != "" ]; then
"$bin"/hbase-daemons.sh --hosts ${hosts} stop rest
fi
"$bin"/hbase-daemons.sh --hosts ${hosts} stop regionserver "$bin"/hbase-daemons.sh --hosts ${hosts} stop regionserver
if [ "$restart" != "" ]; then if [ "$restart" != "" ]; then
"$bin"/hbase-daemons.sh --hosts ${hosts} start regionserver "$bin"/hbase-daemons.sh --hosts ${hosts} start regionserver
if [ "$thrift" != "" ]; then
# -b 0.0.0.0 says listen on all interfaces rather than just default.
"$bin"/hbase-daemons.sh --hosts ${hosts} start thrift -b 0.0.0.0
fi
if [ "$rest" != "" ]; then
"$bin"/hbase-daemons.sh --hosts ${hosts} start rest
fi
if [ "$reload" != "" ]; then if [ "$reload" != "" ]; then
echo "Reloading $hostname region(s)" echo "Reloading $hostname region(s)"
HBASE_NOEXEC=true "$bin"/hbase org.jruby.Main "$bin"/region_mover.rb --file=$filename $debug load $hostname HBASE_NOEXEC=true "$bin"/hbase org.jruby.Main "$bin"/region_mover.rb --file=$filename $debug load $hostname