From 91224564bbe9e88c8d79e5ccfa168dc5224af636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Busse?= Date: Wed, 3 Mar 2021 18:58:43 +0100 Subject: [PATCH] Add hbase bootstrap script --- hbase-setup.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 hbase-setup.sh diff --git a/hbase-setup.sh b/hbase-setup.sh new file mode 100755 index 0000000..6dddebe --- /dev/null +++ b/hbase-setup.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +set -xueo pipefail + +HBASE_VERSION="2.4.1" +HBASE_FILE="hbase-${HBASE_VERSION}-bin.tar.gz" +HBASE_URL="https://downloads.apache.org/hbase/${HBASE_VERSION}/${HBASE_FILE}" +HBASE_FILE_CKSUM="5afb643c2391461619516624168e042b42a66e25217a3319552264c6af522e3a21a5212bfcba759b7b976794648ef13ee7b5a415f33cdb89bba43d40162aa685" +HBASE_HOST="127.0.0.1" + +declare -a DEPS=("java") + +check_dependencies() { + for i in "${DEPS[@]}" + do + if [[ -z $(which "${i}") ]]; then + error "Could not find ${i}" + exit 1 + fi + done +} + +download() { + if [ -f "$HBASE_FILE" ]; then + CKSUM="$(sha512 -q ${HBASE_FILE})" + if [ "$CKSUM" = "$HBASE_FILE_CKSUM" ]; then + echo "${1} exists." + fi + else + curl -LO ${1} + fi + + tar xfz ${HBASE_FILE} +} + +create_config() { + cat < $1 + + + + + hbase.rootdir + file://${1}/hbase + + + hbase.zookeeper.property.dataDir + ${1}/zookeeper + + +EOF +} + +check_dependencies +download ${HBASE_URL} +create_config "hbase-${HBASE_VERSION}/conf/hbase-site.xml"