functions.configure_cdh_hbase.sh Maven / Gradle / Ivy
#
# 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.
#
function configure_cdh_hbase() {
local OPTIND
local OPTARG
ROLES=$1
shift
# get parameters
MASTER_HOST=
ZOOKEEPER_QUORUM=
PORT=
CLOUD_PROVIDER=
HBASE_TAR_URL=
while getopts "m:q:p:c:u:" OPTION; do
case $OPTION in
m)
MASTER_HOST="$OPTARG"
;;
q)
ZOOKEEPER_QUORUM="$OPTARG"
;;
p)
PORT="$OPTARG"
;;
c)
CLOUD_PROVIDER="$OPTARG"
;;
u)
HBASE_TAR_URL="$OPTARG"
;;
esac
done
# determine machine name
case $CLOUD_PROVIDER in
ec2 | aws-ec2 )
# Use public hostname for EC2
SELF_HOST=`wget -q -O - http://169.254.169.254/latest/meta-data/public-hostname`
;;
*)
SELF_HOST=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
;;
esac
HBASE_HOME=/usr/lib/$HBASE_VERSION
HBASE_CONF_DIR=/etc/hbase/conf
case $CLOUD_PROVIDER in
ec2 | aws-ec2 )
# Alias /mnt as /data
if [ ! -e /data ]; then ln -s /mnt /data; fi
;;
*)
;;
esac
mkdir -p /data/hbase
chown hbase:hbase /data/hbase
if [ ! -e /data/tmp ]; then
mkdir /data/tmp
chmod a+rwxt /data/tmp
fi
##############################################################################
# Modify this section to customize your HBase cluster.
##############################################################################
cat > $HBASE_CONF_DIR/hbase-site.xml <
hbase.rootdir
hdfs://$MASTER_HOST:8020/hbase
hbase.cluster.distributed
true
hbase.zookeeper.quorum
$ZOOKEEPER_QUORUM
hbase.regionserver.handler.count
100
dfs.replication
3
zookeeper.session.timeout
60000
hbase.tmp.dir
/data/tmp/hbase-\${user.name}
hbase.client.retries.number
100
EOF
# override JVM options
cat >> $HBASE_CONF_DIR/hbase-env.sh < $HBASE_CONF_DIR/hadoop-metrics.properties <