4 # * Licensed to the Apache Software Foundation (ASF) under one
5 # * or more contributor license agreements. See the NOTICE file
6 # * distributed with this work for additional information
7 # * regarding copyright ownership. The ASF licenses this file
8 # * to you under the Apache License, Version 2.0 (the
9 # * "License"); you may not use this file except in compliance
10 # * with the License. You may obtain a copy of the License at
12 # * http://www.apache.org/licenses/LICENSE-2.0
14 # * Unless required by applicable law or agreed to in writing, software
15 # * distributed under the License is distributed on an "AS IS" BASIS,
16 # * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # * See the License for the specific language governing permissions and
18 # * limitations under the License.
21 # Modelled after $HADOOP_HOME/bin/stop-hbase.sh.
23 # Stop hadoop hbase daemons. Run this on master node.
25 bin
=`dirname "${BASH_SOURCE-$0}"`
26 bin
=`cd "$bin">/dev/null; pwd`
28 .
"$bin"/hbase-config.sh
29 .
"$bin"/hbase-common.sh
31 # variables needed for stop command
32 if [ "$HBASE_LOG_DIR" = "" ]; then
33 export HBASE_LOG_DIR
="$HBASE_HOME/logs"
35 mkdir
-p "$HBASE_LOG_DIR"
37 if [ "$HBASE_IDENT_STRING" = "" ]; then
38 export HBASE_IDENT_STRING
="$USER"
41 export HBASE_LOG_PREFIX
=hbase-
$HBASE_IDENT_STRING-master-$HOSTNAME
42 export HBASE_LOGFILE
=$HBASE_LOG_PREFIX.log
43 logout=$HBASE_LOG_DIR/$HBASE_LOG_PREFIX.out
44 loglog
="${HBASE_LOG_DIR}/${HBASE_LOGFILE}"
45 pid
=${HBASE_PID_DIR:-/tmp}/hbase-
$HBASE_IDENT_STRING-master.pid
47 echo -n stopping hbase
48 echo "`date` Stopping hbase (via master)" >> $loglog
50 nohup nice
-n ${HBASE_NICENESS:-0} "$HBASE_HOME"/bin
/hbase \
51 --config "${HBASE_CONF_DIR}" \
52 master stop
"$@" > "$logout" 2>&1 < /dev
/null
&
54 waitForProcessEnd
`cat $pid` 'stop-master-command'
59 # distributed == false means that the HMaster will kill ZK when it exits
60 # HBASE-6504 - only take the first line of the output in case verbose gc is on
61 distMode
=`$bin/hbase --config "$HBASE_CONF_DIR" org.apache.hadoop.hbase.util.HBaseConfTool hbase.cluster.distributed | head -n 1`
62 if [ "$distMode" == 'true' ]
64 "$bin"/hbase-daemons.sh
--config "${HBASE_CONF_DIR}" stop zookeeper