HBASE-26811 Secondary replica may be disabled for read forever (#4182)
[hbase.git] / bin / hbase-daemons.sh
blobb1785f6a8c43347934f4f2cce7dc2e01539caaf1
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 # Run a hbase command on all slave hosts.
22 # Modelled after $HADOOP_HOME/bin/hadoop-daemons.sh
24 usage="Usage: hbase-daemons.sh [--config <hbase-confdir>] [--autostart-window-size <window size in hours>]\
25 [--autostart-window-retry-limit <retry count limit for autostart>] \
26 [--hosts regionserversfile] [autostart|autorestart|restart|start|stop] command args..."
28 # if no args specified, show usage
29 if [ $# -le 1 ]; then
30 echo $usage
31 exit 1
34 bin=`dirname "${BASH_SOURCE-$0}"`
35 bin=`cd "$bin">/dev/null; pwd`
37 # default autostart args value indicating infinite window size and no retry limit
38 AUTOSTART_WINDOW_SIZE=0
39 AUTOSTART_WINDOW_RETRY_LIMIT=0
41 . $bin/hbase-config.sh
43 if [[ "$1" = "autostart" || "$1" = "autorestart" ]]
44 then
45 autostart_args="--autostart-window-size ${AUTOSTART_WINDOW_SIZE} --autostart-window-retry-limit ${AUTOSTART_WINDOW_RETRY_LIMIT}"
48 remote_cmd="$bin/hbase-daemon.sh --config ${HBASE_CONF_DIR} ${autostart_args} $@"
49 args="--hosts ${HBASE_REGIONSERVERS} --config ${HBASE_CONF_DIR} $remote_cmd"
51 command=$2
52 case $command in
53 (zookeeper)
54 exec "$bin/zookeepers.sh" $args
56 (master-backup)
57 exec "$bin/master-backup.sh" $args
59 (*)
60 exec "$bin/regionservers.sh" $args
62 esac