and the use of docker hbase external zookeeper

Recently, companies need a single node hbase, do not use the built-zookeeper, zookeeper is our docker of a single node, hbase have to do docker of a single node, so the following is a self-written Dockerfile

A, hbase of Dockerfile

FROM ubuntu 
ADD ["jdk.tar.gz","/usr/local/"]
ADD ["hbase.tar.gz","/opt/"]
COPY ["entrypoint.sh","/"]
ENV JAVA_HOME /usr/local/jdk
ENV PATH ${PATH}:${JAVA_HOME}/bin
RUN echo "Asia/Shanghai" > /etc/timezone
EXPOSE 16000 16010 16020 16030 
VOLUME /opt/hbase/data
ENTRYPOINT /entrypoint.sh
View Code

Two, hbase of entrypoint.sh

#!/bin/bash
Host_Name=`hostname`
Conf_Dir=/opt/hbase/conf
if [ -n ${ZK_Server} ]; then
  sed -i "/zookeeper.quorum/{n;s/.*/  <value>${ZK_Server}<\/value>/g}" ${Conf_Dir}/hbase-site.xml
fi
if [-n ${ZK_Port}]; then
  sed -i "/zookeeper.property.clientPort/{n;s/.*/  <value>${ZK_Port}<\/value>/g}" ${Confi_Dir}/hbase-site.xml
fi

bash /opt/hbase/bin/start-hbase.sh
tail -F /opt/hbase/logs/hbase--master-${Host_Name}.log
View Code

Three, hbase of docker-compose documents

version: "3"
services:
  hbase:
    image: registry.cn-beijing.aliyuncs.com/wavewisdom-bj-registry-common/hbase:2.2.2
    container_name: hbase
    environment:
      - "ZK_Server=193.168.1.136"
      - "ZK_Port=2181"
    ports:
      - "16000:16000"
      - "16010:16010"
      - "16020:16020"
      - "16030:16030"
    volumes:
      - "/home/volumes/hbase/data:/opt/hbase/data"
      - "/etc/localtime:/etc/localtime:ro"
    restart: always
View Code

Fourth, explain: To observe the boot log will still find the program will automatically binding2181 port, but hbase and region already registered to self-built zookeeper, the test is normal.

Guess you like

Origin www.cnblogs.com/caibao666/p/12056219.html