From 803a91646c4d20bb1d536deed0ddc338cfd9318e Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Wed, 6 Apr 2011 23:14:01 +0000 Subject: [PATCH] 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 --- CHANGES.txt | 1 + bin/graceful_stop.sh | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index a602b23ddcd..d7a9ecfdc64 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -141,6 +141,7 @@ Release 0.91.0 - Unreleased HBASE-3573 Move shutdown messaging OFF hearbeat; prereq for fix of hbase-1502 HBASE-3071 Graceful decommissioning of a regionserver + HBASE-3748 Add rolling of thrift/rest daemons to graceful_stop.sh script NEW FEATURES diff --git a/bin/graceful_stop.sh b/bin/graceful_stop.sh index d51b86f9e9e..84806043fe5 100644 --- a/bin/graceful_stop.sh +++ b/bin/graceful_stop.sh @@ -23,7 +23,9 @@ # Move regions off a server then stop it. Optionally restart and reload. # Turn off the balancer before running this script. function usage { - echo "Usage: graceful_stop.sh [--config ] [--restart] [--reload] " + echo "Usage: graceful_stop.sh [--config ] [--restart] [--reload] [--thrift] [--rest] " + 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 " reload 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= reload= debug= +thrift= +rest= while [ $# -gt 0 ] do case "$1" in + --thrift) thrift=true; shift;; + --rest) rest=true; shift;; --restart) restart=true; shift;; --reload) reload=true; 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 hosts="/tmp/$(basename $0).$$.tmp" 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 if [ "$restart" != "" ]; then "$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 echo "Reloading $hostname region(s)" HBASE_NOEXEC=true "$bin"/hbase org.jruby.Main "$bin"/region_mover.rb --file=$filename $debug load $hostname