Repository: hbase Updated Branches: refs/heads/0.98 f73f18abb -> e7ff09210
HBASE-11948 graceful_stop.sh should use hbase-daemon.sh when executed on the decomissioned node (Sebastien Barrier) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/e7ff0921 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e7ff0921 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e7ff0921 Branch: refs/heads/0.98 Commit: e7ff09210b84d37d65749a3d86c707c1bc4c6083 Parents: f73f18a Author: Ted Yu <te...@apache.org> Authored: Fri Sep 26 20:41:57 2014 +0000 Committer: Ted Yu <te...@apache.org> Committed: Fri Sep 26 20:41:57 2014 +0000 ---------------------------------------------------------------------- bin/graceful_stop.sh | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/e7ff0921/bin/graceful_stop.sh ---------------------------------------------------------------------- diff --git a/bin/graceful_stop.sh b/bin/graceful_stop.sh index ed9af23..8030600 100755 --- a/bin/graceful_stop.sh +++ b/bin/graceful_stop.sh @@ -86,6 +86,13 @@ fi hostname=$1 filename="/tmp/$hostname" +local=false +localhostname=`/bin/hostname` + +if [ "$localhostname" == "$hostname" ]; then + local=true +fi + log "Disabling load balancer" HBASE_BALANCER_STATE=`echo 'balance_switch false' | "$bin"/hbase --config ${HBASE_CONF_DIR} shell | tail -3 | head -1` log "Previous balancer state was $HBASE_BALANCER_STATE" @@ -99,26 +106,49 @@ hosts="/tmp/$(basename $0).$$.tmp" echo $hostname >> $hosts if [ "$thrift" != "" ]; then log "Stopping thrift" - "$bin"/hbase-daemons.sh --config ${HBASE_CONF_DIR} --hosts ${hosts} stop thrift + if [ "$local" ]; then + "$bin"/hbase-daemon.sh --config ${HBASE_CONF_DIR} stop thrift + else + "$bin"/hbase-daemons.sh --config ${HBASE_CONF_DIR} --hosts ${hosts} stop thrift + fi fi if [ "$rest" != "" ]; then log "Stopping rest" - "$bin"/hbase-daemons.sh --config ${HBASE_CONF_DIR} --hosts ${hosts} stop rest + if [ "$local" ]; then + "$bin"/hbase-daemon.sh --config ${HBASE_CONF_DIR} stop rest + else + "$bin"/hbase-daemons.sh --config ${HBASE_CONF_DIR} --hosts ${hosts} stop rest + fi fi log "Stopping regionserver" -"$bin"/hbase-daemons.sh --config ${HBASE_CONF_DIR} --hosts ${hosts} stop regionserver - +if [ "$local" ]; then + "$bin"/hbase-daemon.sh --config ${HBASE_CONF_DIR} stop regionserver +else + "$bin"/hbase-daemons.sh --config ${HBASE_CONF_DIR} --hosts ${hosts} stop regionserver +fi if [ "$restart" != "" ]; then log "Restarting regionserver" - "$bin"/hbase-daemons.sh --config ${HBASE_CONF_DIR} --hosts ${hosts} start regionserver + if [ "$local" ]; then + "$bin"/hbase-daemon.sh --config ${HBASE_CONF_DIR} start regionserver + else + "$bin"/hbase-daemons.sh --config ${HBASE_CONF_DIR} --hosts ${hosts} start regionserver + fi if [ "$thrift" != "" ]; then log "Restarting thrift" # -b 0.0.0.0 says listen on all interfaces rather than just default. - "$bin"/hbase-daemons.sh --config ${HBASE_CONF_DIR} --hosts ${hosts} start thrift -b 0.0.0.0 + if [ "$local" ]; then + "$bin"/hbase-daemon.sh --config ${HBASE_CONF_DIR} start thrift -b 0.0.0.0 + else + "$bin"/hbase-daemons.sh --config ${HBASE_CONF_DIR} --hosts ${hosts} start thrift -b 0.0.0.0 + fi fi if [ "$rest" != "" ]; then log "Restarting rest" - "$bin"/hbase-daemons.sh --config ${HBASE_CONF_DIR} --hosts ${hosts} start rest + if [ "$local" ]; then + "$bin"/hbase-daemon.sh --config ${HBASE_CONF_DIR} start rest + else + "$bin"/hbase-daemons.sh --config ${HBASE_CONF_DIR} --hosts ${hosts} start rest + fi fi if [ "$reload" != "" ]; then log "Reloading $hostname region(s)"