HBASE-11948 graceful_stop.sh should use hbase-daemon.sh when executed on the decomissioned node (Sebastien Barrier)

This commit is contained in:
Ted Yu 2014-09-26 15:35:57 +00:00
parent 375fc1efe3
commit 88cd708d8d
1 changed files with 37 additions and 7 deletions

View File

@ -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)"