HBASE-2871 Make 'start|stop' commands symmetric for Master & Cluster

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@982123 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-08-04 05:27:09 +00:00
parent 094197a180
commit 2db593c8c6
3 changed files with 34 additions and 6 deletions

View File

@ -466,6 +466,8 @@ Release 0.21.0 - Unreleased
HBASE-2892 Replication metrics aren't updated
HBASE-2461 Split doesn't handle IOExceptions when creating new region
reference files
HBASE-2871 Make "start|stop" commands symmetric for Master & Cluster
(Nicolas Spiegelberg via Stack)
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable

View File

@ -132,13 +132,12 @@ case $startStop in
(stop)
if [ -f $pid ]; then
# kill -0 == see if the PID exists
if kill -0 `cat $pid` > /dev/null 2>&1; then
echo -n stopping $command
echo "`date` Stopping $command" >> $loglog
if [ "$command" = "master" ]; then
nohup nice -n $HBASE_NICENESS "$HBASE_HOME"/bin/hbase \
--config "${HBASE_CONF_DIR}" \
$command $startStop "$@" > "$logout" 2>&1 < /dev/null &
echo "`date` Killing $command" >> $loglog
kill -9 `cat $pid` > /dev/null 2>&1
else
echo "`date` Killing $command" >> $loglog
kill `cat $pid` > /dev/null 2>&1
@ -150,7 +149,7 @@ case $startStop in
echo
else
retval=$?
echo no $command to stop because kill of pid `cat $pid` failed with status $retval
echo no $command to stop because kill -0 of pid `cat $pid` failed with status $retval
fi
else
echo no $command to stop because no pid file $pid

View File

@ -29,7 +29,34 @@ bin=`cd "$bin">/dev/null; pwd`
. "$bin"/hbase-config.sh
"$bin"/hbase-daemon.sh --config "${HBASE_CONF_DIR}" stop master
# variables needed for stop command
if [ "$HBASE_LOG_DIR" = "" ]; then
export HBASE_LOG_DIR="$HBASE_HOME/logs"
fi
mkdir -p "$HBASE_LOG_DIR"
if [ "$HBASE_IDENT_STRING" = "" ]; then
export HBASE_IDENT_STRING="$USER"
fi
export HBASE_LOGFILE=hbase-$HBASE_IDENT_STRING-master-$HOSTNAME.log
logout=$HBASE_LOG_DIR/hbase-$HBASE_IDENT_STRING-master-$HOSTNAME.out
loglog="${HBASE_LOG_DIR}/${HBASE_LOGFILE}"
pid=${HBASE_PID_DIR:-/tmp}/hbase-$HBASE_IDENT_STRING-master.pid
echo -n stopping hbase
echo "`date` Stopping hbase (via master)" >> $loglog
nohup nice -n ${HBASE_NICENESS:-0} "$HBASE_HOME"/bin/hbase \
--config "${HBASE_CONF_DIR}" \
master stop "$@" > "$logout" 2>&1 < /dev/null &
while kill -0 `cat $pid` > /dev/null 2>&1; do
echo -n "."
sleep 1;
done
# distributed == false means that the HMaster will kill ZK when it exits
distMode=`$bin/hbase org.apache.hadoop.hbase.HBaseConfTool hbase.cluster.distributed`
if [ "$distMode" == 'true' ]
then