Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
425 changes: 425 additions & 0 deletions docker/HBASE.md

Large diffs are not rendered by default.

109 changes: 109 additions & 0 deletions docker/hbase/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# 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.
#
# Standalone HBase 2.6.5 image for HugeGraph HBase backend testing.
# Exposes ZooKeeper on 2181 with znode /hbase (matching hugegraph.properties defaults).

FROM eclipse-temurin:11-jre-jammy

ARG HBASE_VERSION=2.6.5
ARG HBASE_PRIMARY_URL=https://archive.apache.org/dist/hbase/${HBASE_VERSION}/hbase-${HBASE_VERSION}-bin.tar.gz
ARG HBASE_FALLBACK_URL=https://downloads.apache.org/hbase/${HBASE_VERSION}/hbase-${HBASE_VERSION}-bin.tar.gz
ARG ALLOW_UNVERIFIED_DOWNLOAD=false

ENV HBASE_VERSION=${HBASE_VERSION}
ENV HBASE_HOME=/opt/hbase
ENV PATH=${HBASE_HOME}/bin:${PATH}

RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
netcat-openbsd \
&& rm -rf /var/lib/apt/lists/*

RUN set -eux; \
download_ok=0; \
downloaded_url=""; \
for url in "${HBASE_PRIMARY_URL}" "${HBASE_FALLBACK_URL}"; do \
[ -n "${url}" ] || continue; \
echo "Downloading HBase from ${url}"; \
if curl -fL --retry 8 --retry-delay 5 --retry-all-errors \
--connect-timeout 30 --max-time 1800 "${url}" -o /tmp/hbase.tar.gz; then \
download_ok=1; \
downloaded_url="${url}"; \
break; \
fi; \
echo "Download failed for ${url}, trying next source..."; \
rm -f /tmp/hbase.tar.gz; \
done; \
if [ "${download_ok}" -ne 1 ]; then \
echo "Unable to download HBase ${HBASE_VERSION} tarball from configured sources"; \
exit 1; \
fi; \
checksum_ok=0; \
for checksum_url in "${downloaded_url}.sha512" "${HBASE_PRIMARY_URL}.sha512" "${HBASE_FALLBACK_URL}.sha512"; do \
[ -n "${checksum_url}" ] || continue; \
if curl -fL --retry 5 --retry-delay 3 --retry-all-errors \
--connect-timeout 30 "${checksum_url}" -o /tmp/hbase.tar.gz.sha512 2>/dev/null; then \
checksum_ok=1; \
break; \
fi; \
done; \
if [ "${checksum_ok}" -eq 1 ]; then \
echo "Verifying SHA512 checksum..."; \
expected_hash=$(grep -Eio '[a-f0-9]{128}' /tmp/hbase.tar.gz.sha512 | head -n 1 | tr 'A-F' 'a-f' || true); \
if [ -z "$expected_hash" ]; then \
expected_hash=$(awk '{for (i = 1; i <= NF; i++) if (length($i) >= 8 && $i ~ /^[0-9A-Fa-f]+$/) hash = hash $i} END {if (length(hash) >= 128) print tolower(substr(hash, 1, 128))}' /tmp/hbase.tar.gz.sha512 || true); \
fi; \
if [ -n "$expected_hash" ]; then \
actual_hash=$(sha512sum /tmp/hbase.tar.gz | awk '{print $1}'); \
if [ "$expected_hash" = "$actual_hash" ]; then \
echo "SHA512 verified OK"; \
else \
echo "ERROR: SHA512 mismatch"; \
echo " Expected: $expected_hash"; \
echo " Actual: $actual_hash"; \
exit 1; \
fi; \
else \
if [ "${ALLOW_UNVERIFIED_DOWNLOAD}" = "true" ]; then \
echo "WARNING: Could not parse SHA512 file (ALLOW_UNVERIFIED_DOWNLOAD=true)"; \
else \
echo "ERROR: Could not parse SHA512 file"; \
exit 1; \
fi; \
fi; \
else \
if [ "${ALLOW_UNVERIFIED_DOWNLOAD}" = "true" ]; then \
echo "WARNING: Could not download SHA512 file (ALLOW_UNVERIFIED_DOWNLOAD=true)"; \
else \
echo "ERROR: Could not download SHA512 file"; \
exit 1; \
fi; \
fi; \
tar -xzf /tmp/hbase.tar.gz -C /opt; \
mv /opt/hbase-${HBASE_VERSION} ${HBASE_HOME}; \
rm -f /tmp/hbase.tar.gz /tmp/hbase.tar.gz.sha512

# hbase-site.xml: standalone mode, znode=/hbase (matches hugegraph.properties)
COPY hbase-site.xml ${HBASE_HOME}/conf/hbase-site.xml

# Entrypoint: start HBase then tail the master log
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

EXPOSE 2181 16000 16010 16020 16030

ENTRYPOINT ["/entrypoint.sh"]

72 changes: 72 additions & 0 deletions docker/hbase/docker-compose.hbase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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.
#
# HBase standalone for local HugeGraph HBase backend development & testing.
#
# Usage:
# Start: docker compose -f docker/hbase/docker-compose.hbase.yml up -d
# Wait: docker compose -f docker/hbase/docker-compose.hbase.yml logs -f hbase
# Verify: nc -z localhost 2181 && echo "ZooKeeper OK"
# Test: mvn test -pl hugegraph-server/hugegraph-test -am -P core-test,hbase
# Stop: docker compose -f docker/hbase/docker-compose.hbase.yml down -v
#
# HugeGraph test config (hugegraph-server/hugegraph-test/src/main/resources/hugegraph.properties):
# hbase.hosts=localhost
# hbase.port=2181
# hbase.znode_parent=/hbase
#
# Ports exposed to host:
# 2181 - ZooKeeper (HBase embedded)
# 16000 - HBase Master RPC
# 16010 - HBase Master Web UI -> http://localhost:16010
# 16020 - HBase RegionServer RPC
# 16030 - HBase RegionServer Web UI -> http://localhost:16030

services:
hbase:
build:
context: .
dockerfile: Dockerfile
args:
HBASE_VERSION: "2.6.5"
# Optional overrides for flaky networks/corporate mirrors.
HBASE_PRIMARY_URL: "${HBASE_PRIMARY_URL:-https://downloads.apache.org/hbase/2.6.5/hbase-2.6.5-bin.tar.gz}"
HBASE_FALLBACK_URL: "${HBASE_FALLBACK_URL:-https://archive.apache.org/dist/hbase/2.6.5/hbase-2.6.5-bin.tar.gz}"
image: hugegraph/hbase:2.6.5
container_name: hg-hbase-test
hostname: hbase
ports:
- "2181:2181" # ZooKeeper (matches hbase.port in hugegraph.properties)
- "16000:16000" # Master RPC
- "16010:16010" # Master Web UI -> http://localhost:16010
- "16020:16020" # RegionServer RPC
- "16030:16030" # RegionServer Web UI -> http://localhost:16030
volumes:
- hbase-data:/tmp/hbase
- hbase-zk-data:/tmp/zookeeper
healthcheck:
# nc -z confirms ZooKeeper is accepting connections
test: ["CMD", "nc", "-z", "localhost", "2181"]
interval: 10s
timeout: 10s
retries: 15
start_period: 90s
restart: unless-stopped

volumes:
hbase-data:
hbase-zk-data:


62 changes: 62 additions & 0 deletions docker/hbase/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash
#
# 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.
#
set -e

echo "Starting HBase ${HBASE_VERSION} standalone..."

# Start services explicitly to avoid SSH-based helper assumptions in containers
${HBASE_HOME}/bin/hbase-daemon.sh start zookeeper
${HBASE_HOME}/bin/hbase-daemon.sh start master
${HBASE_HOME}/bin/hbase-daemon.sh start regionserver

echo "HBase started. Waiting for ZooKeeper on port 2181..."
zk_attempts=0
until nc -z localhost 2181; do
zk_attempts=$((zk_attempts + 1))
if [ "$zk_attempts" -ge 120 ]; then
echo "Timed out waiting for ZooKeeper on 2181"
${HBASE_HOME}/bin/hbase-daemon.sh status || true
exit 1
fi
sleep 1
done
echo "ZooKeeper is ready."

echo "Waiting for HBase Master..."
master_attempts=0
until echo "status 'simple'" | ${HBASE_HOME}/bin/hbase shell -n 2>/dev/null | grep -E -q "([1-9][0-9]*[[:space:]]+live[[:space:]]+servers|[1-9][0-9]*[[:space:]]+servers|servers:[[:space:]]*[1-9])"; do
master_attempts=$((master_attempts + 1))
if [ "$master_attempts" -ge 180 ]; then
echo "Timed out waiting for HBase master/regionserver readiness"
${HBASE_HOME}/bin/hbase-daemon.sh status || true
tail -n 80 ${HBASE_HOME}/logs/hbase-*.out ${HBASE_HOME}/logs/hbase-*.log \
2>/dev/null || true
exit 1
fi
sleep 3
done
echo "HBase is ready. Master + RegionServer online."

# Tail all daemon logs so `docker logs` includes startup/runtime issues
shopt -s nullglob
log_files=("${HBASE_HOME}/logs"/hbase-*.out "${HBASE_HOME}/logs"/hbase-*.log)
if [ ${#log_files[@]} -gt 0 ]; then
exec tail -F "${log_files[@]}"
fi
exec tail -f /dev/null

89 changes: 89 additions & 0 deletions docker/hbase/hbase-site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0"?>
<!--
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.
-->
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<!-- Standalone mode: use local filesystem -->
<property>
<name>hbase.rootdir</name>
<value>file:///tmp/hbase</value>
</property>
<!-- Embedded ZooKeeper data directory -->
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/tmp/zookeeper</value>
</property>
Comment thread
vaijosh marked this conversation as resolved.
<!-- Keep ZooKeeper quorum explicit for containerized single-node setup -->
<property>
<name>hbase.zookeeper.quorum</name>
<value>localhost</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
<!-- Allow unlimited ZooKeeper client connections -->
<property>
<name>hbase.zookeeper.property.maxClientCnxns</name>
<value>0</value>
</property>
<!-- Match hugegraph.properties: hbase.znode_parent=/hbase -->
<property>
<name>zookeeper.znode.parent</name>
<value>/hbase</value>
</property>
<!-- Longer tick + session for slow CI/test environments -->
<property>
<name>hbase.zookeeper.property.tickTime</name>
<value>6000</value>
</property>
<property>
<name>zookeeper.session.timeout</name>
<value>180000</value>
</property>
<!-- Pseudo-distributed mode so master + regionserver run as distinct daemons -->
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<!-- Local FS in single-node Docker may not support async WAL hflush -->
<property>
<name>hbase.wal.provider</name>
<value>filesystem</value>
</property>
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>
<property>
<name>hbase.master.hostname</name>
<value>localhost</value>
</property>
<property>
<name>hbase.regionserver.hostname</name>
<value>localhost</value>
</property>
<property>
<name>hbase.master.ipc.address</name>
<value>0.0.0.0</value>
</property>
<property>
<name>hbase.regionserver.ipc.address</name>
<value>0.0.0.0</value>
</property>
</configuration>

Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,12 @@
<name>hbase.zookeeper.property.tickTime</name>
<value>6000</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>false</value>
</property>
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set -ev

TRAVIS_DIR=$(dirname $0)
HBASE_DOWNLOAD_ADDRESS="https://archive.apache.org/dist/hbase"
HBASE_VERSION="2.0.2"
HBASE_VERSION="2.6.5"
HBASE_PACKAGE="hbase-${HBASE_VERSION}"
HBASE_TAR="${HBASE_PACKAGE}-bin.tar.gz"

Expand Down
Loading