hbase/bin/stop-hbase.sh

72 lines
2.4 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
#
#/**
# * Copyright 2007 The Apache Software Foundation
# *
# * Licensed to the Apache Software Foundation (ASF) under one
# * or more contributor license agreements. See the NOTICE file
# * distributed with this work for additional information
# * regarding copyright ownership. The ASF licenses this file
# * to you under the Apache License, Version 2.0 (the
# * "License"); you may not use this file except in compliance
# * with the License. You may obtain a copy of the License at
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# */
# Modelled after $HADOOP_HOME/bin/stop-hbase.sh.
# Stop hadoop hbase daemons. Run this on master node.
bin=`dirname "${BASH_SOURCE-$0}"`
bin=`cd "$bin">/dev/null; pwd`
. "$bin"/hbase-config.sh
# 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
# Add a CR after we're done w/ dots.
echo
# distributed == false means that the HMaster will kill ZK when it exits
HBASE-2692 Master rewrite and cleanup for 0.90 Patch brought over from 0.90_master_rewrite branch. Replication test is broke as are some of the rest tests. Others should be passing. Some of the changes made in this fat patch: + In HLogKey, we now use encoded region name instead of full region name. + On split, daughters are opened on the parent's regionserver; let the new balancer sort them out later when it cuts in. + Added move region from one server to another as well as enable/disable balancer. + All .META. and -ROOT- edits go via new *Editor and *Reader classes -- no more do we have 5 different ways of reading and editing .META. + Rather than 3 different listeners to hlog each w/ own way of listening, instead we only have WALObserver now. + New Server Interface that has whats common to HMaster and RegionServer. Also new Services Interface. This should make test writing cleaner making it so less need of full cluster context testing anything -- e.g. the new Interfaces are good w/ Mockito. + New balacner that runs on a period and takes into consideration all load across cluster. + Table online/offline is now a flag in ZK; the offline flag on a region is just used splitting from here on out. + Moved fixup of failed add of daughter edits to .META. into shutdown server recover code (It used to be in basescanner). + The heartbeat now sends master the regionserver load and is used sending shutdown message from master to regionserver ONLY; all other messages are via zk (HMsg is pretty bare now). + No more Worker in RS and ToDoQueue in master. Both in master and regionserver we use handlers instead run out of Executors. + Client can not send split, flush, compact direct to RS; no longer does it go via master. + Server shutdown runs differently now. All are watching a flag in zk. When RS notices its gone, it closes all user-space regions. If thats all it was carrying, then it goes down. Otherwise, waits on master to send the shutdown msg via heartbeat. git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@991397 13f79535-47bb-0310-9956-ffa450edef68
2010-08-31 19:51:44 -04:00
distMode=`$bin/hbase org.apache.hadoop.hbase.util.HBaseConfTool hbase.cluster.distributed`
if [ "$distMode" == 'true' ]
then
# TODO: store backup masters in ZooKeeper and have the primary send them a shutdown message
# stop any backup masters
"$bin"/hbase-daemons.sh --config "${HBASE_CONF_DIR}" \
--hosts "${HBASE_BACKUP_MASTERS}" stop master-backup
"$bin"/hbase-daemons.sh --config "${HBASE_CONF_DIR}" stop zookeeper
fi