HBASE-1147 Modify the scripts to use Zookeeper
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@738184 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
14734e4e81
commit
476da38f1f
|
@ -1,6 +1,7 @@
|
|||
HBase Change Log
|
||||
Release 0.20.0 - Unreleased
|
||||
INCOMPATIBLE CHANGES
|
||||
HBASE-1147 Modify the scripts to use Zookeeper
|
||||
|
||||
BUG FIXES
|
||||
HBASE-1140 "ant clean test" fails (Nitay Joffe via Stack)
|
||||
|
|
66
bin/hbase
66
bin/hbase
|
@ -60,6 +60,7 @@ if [ $# = 0 ]; then
|
|||
echo " regionserver run an HBase HRegionServer node"
|
||||
echo " rest run an HBase REST server"
|
||||
echo " thrift run an HBase Thrift server"
|
||||
echo " zookeeper run a Zookeeper server"
|
||||
echo " migrate upgrade an hbase.rootdir"
|
||||
echo " or"
|
||||
echo " CLASSNAME run the class named CLASSNAME"
|
||||
|
@ -181,36 +182,41 @@ fi
|
|||
# restore ordinary behaviour
|
||||
unset IFS
|
||||
|
||||
# figure out which class to run
|
||||
if [ "$COMMAND" = "shell" ] ; then
|
||||
CLASS="org.jruby.Main ${HBASE_HOME}/bin/hirb.rb"
|
||||
elif [ "$COMMAND" = "master" ] ; then
|
||||
CLASS='org.apache.hadoop.hbase.master.HMaster'
|
||||
elif [ "$COMMAND" = "regionserver" ] ; then
|
||||
CLASS='org.apache.hadoop.hbase.regionserver.HRegionServer'
|
||||
elif [ "$COMMAND" = "rest" ] ; then
|
||||
CLASS='org.apache.hadoop.hbase.rest.Dispatcher'
|
||||
elif [ "$COMMAND" = "thrift" ] ; then
|
||||
CLASS='org.apache.hadoop.hbase.thrift.ThriftServer'
|
||||
elif [ "$COMMAND" = "migrate" ] ; then
|
||||
CLASS='org.apache.hadoop.hbase.util.Migrate'
|
||||
# We kill the ZK instance using a hard coded port, to be changed
|
||||
if [ "$COMMAND" = "zookeeper" ] && [ "$@" = "start" ] ; then
|
||||
exec "$JAVA" $JAVA_HEAP_MAX -classpath "$CLASSPATH" org.apache.zookeeper.server.quorum.QuorumPeerMain conf/zoo.cfg
|
||||
else
|
||||
CLASS=$COMMAND
|
||||
fi
|
||||
# figure out which class to run
|
||||
if [ "$COMMAND" = "shell" ] ; then
|
||||
CLASS="org.jruby.Main ${HBASE_HOME}/bin/hirb.rb"
|
||||
elif [ "$COMMAND" = "master" ] ; then
|
||||
CLASS='org.apache.hadoop.hbase.master.HMaster'
|
||||
elif [ "$COMMAND" = "regionserver" ] ; then
|
||||
CLASS='org.apache.hadoop.hbase.regionserver.HRegionServer'
|
||||
elif [ "$COMMAND" = "rest" ] ; then
|
||||
CLASS='org.apache.hadoop.hbase.rest.Dispatcher'
|
||||
elif [ "$COMMAND" = "thrift" ] ; then
|
||||
CLASS='org.apache.hadoop.hbase.thrift.ThriftServer'
|
||||
elif [ "$COMMAND" = "migrate" ] ; then
|
||||
CLASS='org.apache.hadoop.hbase.util.Migrate'
|
||||
else
|
||||
CLASS=$COMMAND
|
||||
fi
|
||||
|
||||
# Have JVM dump heap if we run out of memory. Files will be 'launch directory'
|
||||
# and are named like the following: java_pid21612.hprof. Apparently it doesn't
|
||||
# 'cost' to have this flag enabled. Its a 1.6 flag only. See:
|
||||
# http://blogs.sun.com/alanb/entry/outofmemoryerror_looks_a_bit_better
|
||||
HBASE_OPTS="$HBASE_OPTS -XX:+HeapDumpOnOutOfMemoryError"
|
||||
HBASE_OPTS="$HBASE_OPTS -Dhbase.log.dir=$HBASE_LOG_DIR"
|
||||
HBASE_OPTS="$HBASE_OPTS -Dhbase.log.file=$HBASE_LOGFILE"
|
||||
HBASE_OPTS="$HBASE_OPTS -Dhbase.home.dir=$HBASE_HOME"
|
||||
HBASE_OPTS="$HBASE_OPTS -Dhbase.id.str=$HBASE_IDENT_STRING"
|
||||
HBASE_OPTS="$HBASE_OPTS -Dhbase.root.logger=${HBASE_ROOT_LOGGER:-INFO,console}"
|
||||
if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
|
||||
HBASE_OPTS="$HBASE_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
|
||||
fi
|
||||
# Have JVM dump heap if we run out of memory. Files will be 'launch directory'
|
||||
# and are named like the following: java_pid21612.hprof. Apparently it doesn't
|
||||
# 'cost' to have this flag enabled. Its a 1.6 flag only. See:
|
||||
# http://blogs.sun.com/alanb/entry/outofmemoryerror_looks_a_bit_better
|
||||
HBASE_OPTS="$HBASE_OPTS -XX:+HeapDumpOnOutOfMemoryError"
|
||||
HBASE_OPTS="$HBASE_OPTS -Dhbase.log.dir=$HBASE_LOG_DIR"
|
||||
HBASE_OPTS="$HBASE_OPTS -Dhbase.log.file=$HBASE_LOGFILE"
|
||||
HBASE_OPTS="$HBASE_OPTS -Dhbase.home.dir=$HBASE_HOME"
|
||||
HBASE_OPTS="$HBASE_OPTS -Dhbase.id.str=$HBASE_IDENT_STRING"
|
||||
HBASE_OPTS="$HBASE_OPTS -Dhbase.root.logger=${HBASE_ROOT_LOGGER:-INFO,console}"
|
||||
if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
|
||||
HBASE_OPTS="$HBASE_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
|
||||
fi
|
||||
|
||||
# run it
|
||||
exec "$JAVA" $JAVA_HEAP_MAX $HBASE_OPTS -classpath "$CLASSPATH" $CLASS "$@"
|
||||
# run it
|
||||
exec "$JAVA" $JAVA_HEAP_MAX $HBASE_OPTS -classpath "$CLASSPATH" $CLASS "$@"
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
#/**
|
||||
# * Copyright 2009 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.
|
||||
# */
|
||||
#
|
||||
# Run a hbase command on all slave hosts.
|
||||
# Modelled after $HADOOP_HOME/bin/hadoop-daemons.sh
|
||||
|
||||
usage="Usage: hbase-daemons.sh [--config <hbase-confdir>] \
|
||||
[start|stop] command args..."
|
||||
|
||||
# if no args specified, show usage
|
||||
if [ $# -le 1 ]; then
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bin=`dirname "$0"`
|
||||
bin=`cd "$bin"; pwd`
|
||||
|
||||
. $bin/hbase-config.sh
|
||||
|
||||
exec "$bin/zookeeper.sh" --config "${HBASE_CONF_DIR}" \
|
||||
cd "${HBASE_HOME}" \; \
|
||||
"$bin/hbase-daemon.sh" --config "${HBASE_CONF_DIR}" "$@"
|
|
@ -38,6 +38,8 @@ if [ $errCode -ne 0 ]
|
|||
then
|
||||
exit $errCode
|
||||
fi
|
||||
"$bin"/hbase-zookeeper.sh --config "${HBASE_CONF_DIR}" \
|
||||
start zookeeper
|
||||
"$bin"/hbase-daemon.sh --config "${HBASE_CONF_DIR}" start master
|
||||
"$bin"/hbase-daemons.sh --config "${HBASE_CONF_DIR}" \
|
||||
--hosts "${HBASE_REGIONSERVERS}" start regionserver
|
||||
|
|
|
@ -30,3 +30,5 @@ bin=`cd "$bin"; pwd`
|
|||
. "$bin"/hbase-config.sh
|
||||
|
||||
"$bin"/hbase-daemon.sh --config "${HBASE_CONF_DIR}" stop master
|
||||
"$bin"/hbase-zookeeper.sh --config "${HBASE_CONF_DIR}" \
|
||||
stop zookeeper
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
#/**
|
||||
# * Copyright 2009 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.
|
||||
# */
|
||||
#
|
||||
# Run a shell command on all regionserver hosts.
|
||||
#
|
||||
# Environment Variables
|
||||
#
|
||||
# HADOOP_CONF_DIR Alternate conf dir. Default is ${HADOOP_HOME}/conf.
|
||||
# HBASE_CONF_DIR Alternate hbase conf dir. Default is ${HBASE_HOME}/conf.
|
||||
# HADOOP_SLAVE_SLEEP Seconds to sleep between spawning remote commands.
|
||||
# HADOOP_SSH_OPTS Options passed to ssh when running remote commands.
|
||||
#
|
||||
# Modelled after $HADOOP_HOME/bin/slaves.sh.
|
||||
|
||||
usage="Usage: zookeeper [--config <hbase-confdir>] command..."
|
||||
|
||||
# if no args specified, show usage
|
||||
if [ $# -le 0 ]; then
|
||||
echo $usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bin=`dirname "$0"`
|
||||
bin=`cd "$bin"; pwd`
|
||||
|
||||
. "$bin"/hbase-config.sh
|
||||
|
||||
if [ -f "${HBASE_CONF_DIR}/hbase-env.sh" ]; then
|
||||
. "${HBASE_CONF_DIR}/hbase-env.sh"
|
||||
fi
|
||||
|
||||
if [ "$HBASE_MANAGES_ZK" = "" ]; then
|
||||
HBASE_MANAGES_ZK=true
|
||||
fi
|
||||
|
||||
if [ "$HBASE_MANAGES_ZK" = "true" ]; then
|
||||
ssh $HBASE_SSH_OPTS 127.0.0.1 $"${@// /\\ }" \
|
||||
2>&1 | sed "s/^/$zookeeper: /" &
|
||||
if [ "$HBASE_SLAVE_SLEEP" != "" ]; then
|
||||
sleep $HBASE_SLAVE_SLEEP
|
||||
fi
|
||||
fi
|
||||
|
||||
wait
|
|
@ -55,3 +55,6 @@
|
|||
# can be useful in large clusters, where, e.g., slave rsyncs can
|
||||
# otherwise arrive faster than the master can service them.
|
||||
# export HBASE_SLAVE_SLEEP=0.1
|
||||
|
||||
# Tell HBase whether it should manage it's own instance of Zookeeper or not.
|
||||
# export HBASE_MANAGES_ZK=true
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
# The number of milliseconds of each tick
|
||||
tickTime=2000
|
||||
# The number of ticks that the initial
|
||||
# synchronization phase can take
|
||||
initLimit=10
|
||||
# The number of ticks that can pass between
|
||||
# sending a request and getting an acknowledgement
|
||||
syncLimit=5
|
||||
# the directory where the snapshot is stored.
|
||||
dataDir=/tmp/zookeeper
|
||||
# the port at which the clients will connect
|
||||
clientPort=2181
|
Loading…
Reference in New Issue