HBASE-26765 Minor refactor of async scanning code (#4121)
[hbase.git] / bin / start-hbase.sh
blobf053526245aff60305afbd6bf43cae0d72a96a4b
1 #!/usr/bin/env bash
3 #/**
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
11 # *
12 # * http://www.apache.org/licenses/LICENSE-2.0
13 # *
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.
19 # */
21 # Modelled after $HADOOP_HOME/bin/start-hbase.sh.
23 # Start hadoop hbase daemons.
24 # Run this on master node.
25 usage="Usage: start-hbase.sh [--autostart-window-size <window size in hours>]\
26 [--autostart-window-retry-limit <retry count limit for autostart>]\
27 [autostart|start]"
29 bin=`dirname "${BASH_SOURCE-$0}"`
30 bin=`cd "$bin">/dev/null; pwd`
32 # default autostart args value indicating infinite window size and no retry limit
33 AUTOSTART_WINDOW_SIZE=0
34 AUTOSTART_WINDOW_RETRY_LIMIT=0
36 . "$bin"/hbase-config.sh
38 # start hbase daemons
39 errCode=$?
40 if [ $errCode -ne 0 ]
41 then
42 exit $errCode
45 if [ "$1" = "autostart" ]
46 then
47 commandToRun="--autostart-window-size ${AUTOSTART_WINDOW_SIZE} --autostart-window-retry-limit ${AUTOSTART_WINDOW_RETRY_LIMIT} autostart"
48 else
49 commandToRun="start"
52 # HBASE-6504 - only take the first line of the output in case verbose gc is on
53 distMode=`$bin/hbase --config "$HBASE_CONF_DIR" org.apache.hadoop.hbase.util.HBaseConfTool hbase.cluster.distributed | head -n 1`
55 if [ "$distMode" == 'false' ]
56 then
57 "$bin"/hbase-daemon.sh --config "${HBASE_CONF_DIR}" $commandToRun master
58 else
59 "$bin"/hbase-daemons.sh --config "${HBASE_CONF_DIR}" $commandToRun zookeeper
60 "$bin"/hbase-daemon.sh --config "${HBASE_CONF_DIR}" $commandToRun master
61 "$bin"/hbase-daemons.sh --config "${HBASE_CONF_DIR}" \
62 --hosts "${HBASE_REGIONSERVERS}" $commandToRun regionserver
63 "$bin"/hbase-daemons.sh --config "${HBASE_CONF_DIR}" \
64 --hosts "${HBASE_BACKUP_MASTERS}" $commandToRun master-backup