安装hbase后的引导操作

qzwqbdag  于 2021-06-09  发布在  Hbase
关注(0)|答案(2)|浏览(351)

议题/问题:
如何确保在emr上安装hbase应用程序之后运行emr引导操作?
群集信息:
我使用的是支持hbase 1.4.9的emr-5.25.0版本。
用例:我正在使用引导操作在emr上安装geomesa(见下面的文档)。https://www.geomesa.org/documentation/tutorials/geomesa-hbase-s3-on-aws.html
观察:
我使用下面的代码作为引导操作。我看到下面的引导操作是在集群上安装hbase之前启动的。我想使用引导动作,以确保geomesa是安装在每个主节点的情况下,多主设置。


# !/bin/bash

set -e -x

IS_MASTER=false

if [ -f /mnt/var/lib/info/instance.json ]
then
  IS_MASTER=`cat /mnt/var/lib/info/instance.json | tr -d '\n ' | sed -n 's|.*\"isMaster\":\([^,]*\).*|\1|p'`
fi

if [[ $IS_MASTER == false* ]] 
then
  echo "Not the master server."
  exit 0
else   
  echo "Installing Geomesa on Master Server."  
  GEOMESA_INSTALLATION_FILE_S3_LOCATION="$1"
  GEOMESA_FILE_VERSION="$2"

  # initialize the Geomesa version.
  export GEOMESA_VERSION="$3"

  # Create jars package
  mkdir -p /home/hadoop/jars

  # Copy Geomesa 2.3.0 jars from s3 to local jars folders.
  aws s3 cp $GEOMESA_INSTALLATION_FILE_S3_LOCATION /home/hadoop/jars

  # Move to opt package
  cd /opt/

  # Unzip geomesa jar in /opt package.
  sudo tar zxvf /home/hadoop/jars/geomesa-hbase-dist_${GEOMESA_FILE_VERSION}-bin.tar.gz

  # run bootstrap-geomesa-hbase-aws.sh file to bootstrap geomesa on EMR.
  sudo /opt/geomesa-hbase_${GEOMESA_FILE_VERSION}/bin/bootstrap-geomesa-hbase-aws.sh

  # Go to /etc/hadoop/conf
  cd /etc/hadoop/conf

  # Copy hbase-site.xml in the /etc/hadoop/conf
  sudo cp /usr/lib/hbase/conf/hbase-site.xml /etc/hadoop/conf

  # Create .zip file for hbase-site.xml
  sudo zip /home/hadoop/jars/hbase-site.zip hbase-site.xml

  # initialize GEOMESA_EXTRA_CLASSPATHS to hbase-site.zip
  export GEOMESA_EXTRA_CLASSPATHS=/home/hadoop/jars/hbase-site.zip
fi
xnifntxz

xnifntxz1#

使用 Steps . 引导程序总是在配置服务器之后和安装应用程序之前运行。所以,你必须在脚本中使用步骤。首先,用下面的jar添加自定义jar步骤。

s3://<region prefix>.elasticmapreduce/libs/script-runner/script-runner.jar

论点是

s3://<your bucket>/<path>/<script>.sh

并将失败时的操作设置为 Continue . 不要勾选选项
最后一步完成后自动终止群集

8mmmxcuj

8mmmxcuj2#

如果脚本在hbase设置之前运行就可以了。它称之为 bootstrap-geomesa-hbase-aws.sh 脚本,它将检查是否安装了hbase,并在准备就绪之前休眠。

相关问题