vaijosh commented on code in PR #3021:
URL: https://github.com/apache/hugegraph/pull/3021#discussion_r3247904052


##########
docker/HBASE.md:
##########
@@ -0,0 +1,425 @@
+# HBase Backend Testing with Docker
+
+This guide explains how to start HBase locally with Docker, verify it is 
working, and validate HugeGraph API operations.
+
+> **All commands in this guide should be run from the repository root** unless 
otherwise noted.
+
+> **Recent path change**: The HBase compose file moved from 
`docker/docker-compose.hbase.yml` to `docker/hbase/docker-compose.hbase.yml`. 
If you have older shell history/scripts, update `-f` accordingly.
+
+> **Security note**: The HBase Docker build enforces SHA512 verification by 
default and fails when checksum download/parsing/validation fails. Only use 
`--build-arg ALLOW_UNVERIFIED_DOWNLOAD=true` for trusted test environments with 
restricted networks.
+
+---
+
+## Quick Start
+
+### 0. (Optional) Clean Up Leftover HBase Tables
+```bash
+docker compose -f docker/hbase/docker-compose.hbase.yml build --no-cache hbase
+```
+
+### 1. Start HBase with Docker
+
+```bash
+docker compose -f docker/hbase/docker-compose.hbase.yml up -d
+```
+
+### 2. Wait for HBase to be Ready (~2 minutes)
+
+```bash
+# Check ZooKeeper connectivity
+nc -z localhost 2181 && echo "Ready" || echo "Not ready"
+
+# Or watch the logs
+docker compose -f docker/hbase/docker-compose.hbase.yml logs
+```
+
+### 3. (Optional) Clean Up Leftover HBase Tables
+
+For reruns, drop any leftover HugeGraph tables after the container is up:
+
+```bash
+docker exec hg-hbase-test bash -c '
+  for t in $(echo "list" | hbase shell -n 2>/dev/null | grep 
"^default_hugegraph"); do
+    echo "disable '"'"'$t'"'"'; drop '"'"'$t'"'"'"
+  done | hbase shell
+'
+```
+
+Verify tables are gone before proceeding:
+
+```bash
+docker exec hg-hbase-test bash -lc "echo 'list' | hbase shell -n"
+# Expected: TABLE (empty), 0 row(s)
+```
+
+
+### 4. Configure and Init the HugeGraph Server (required for API tests)
+
+> This step is only needed for HugeGraph API sanity checks.
+
+> **Prerequisite**: Run `mvn clean package -DskipTests` from the repository 
root to generate the distribution. This creates an 
`apache-hugegraph-<version>/` directory with all necessary binaries and configs.
+
+Set backend to HBase in the server config:
+
+```bash
+SERVER_DIR="$(find . -maxdepth 3 -type d -path 
'./apache-hugegraph-*/apache-hugegraph-server-*' | head -n 1)"
+SERVER_DIR="${SERVER_DIR#./}"
+[ -n "$SERVER_DIR" ] || { echo "HugeGraph server runtime not found. Run mvn 
clean package -DskipTests first."; exit 1; }
+CONF="$SERVER_DIR/conf/graphs/hugegraph.properties"
+
+# Switch backend to hbase
+perl -pi -e 's/^backend=.*/backend=hbase/'     "$CONF"
+perl -pi -e 's/^serializer=.*/serializer=hbase/' "$CONF"
+
+# Uncomment HBase connection settings
+perl -pi -e 's/^#(hbase\.hosts=.*)/$1/'        "$CONF"
+perl -pi -e 's/^#(hbase\.port=.*)/$1/'         "$CONF"
+perl -pi -e 's/^#(hbase\.znode_parent=.*)/$1/' "$CONF"
+```
+
+Initialize HBase tables and start the server:
+
+```bash
+printf 'pa\npa\n' | "$SERVER_DIR/bin/init-store.sh"
+"$SERVER_DIR/bin/start-hugegraph.sh" -t 60
+```
+
+After `init-store.sh`, you can verify the tables were created:
+
+```bash
+docker exec hg-hbase-test bash -lc "echo 'list' | hbase shell -n"
+```
+
+---
+
+## Docker Compose Services
+
+### HBase Container
+
+- **Image**: `hugegraph/hbase:2.6.5`
+- **Container Name**: `hg-hbase-test`
+- **Hostname**: `hbase`
+- **Ports**:
+  - `2181` - ZooKeeper (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)
+- **Health Check**: ZooKeeper connectivity on port 2181
+- **Startup Time**: ~90-120 seconds
+
+---
+
+## Manual Verification
+
+### 1. Check Container is Healthy
+
+```bash
+docker compose -f docker/hbase/docker-compose.hbase.yml ps
+docker logs hg-hbase-test | tail -50
+```
+
+### 2. Check ZooKeeper Connectivity
+
+```bash
+# From host machine
+nc -z localhost 2181 && echo "ZooKeeper OK" || echo "ZooKeeper not ready"
+
+# From inside the container
+docker exec hg-hbase-test nc -z localhost 2181 && echo "Ready" || echo "Not 
ready"
+```
+
+### 3. Check HBase Master and RegionServer Web UIs
+
+```bash
+# HBase Master Web UI (should return HTML)
+curl -s http://localhost:16010 | head -20
+
+# RegionServer Web UI
+curl -s http://localhost:16030 | head -20
+
+# Or open in browser
+open http://localhost:16010
+```
+
+### 4. Verify HBase Tables via Shell
+
+```bash
+# List all tables (should show HugeGraph tables after init-store)
+docker exec hg-hbase-test bash -lc "echo 'list' | hbase shell -n"
+
+# Check a specific table exists (example: after backend init)
+docker exec hg-hbase-test bash -lc 'echo "describe 
'"'"'default_hugegraph:g_v'"'"'" | hbase shell -n'
+```
+
+### 5. Verify HBase Logs for Errors
+
+```bash
+# Check for any ERROR lines in HBase logs
+docker exec hg-hbase-test bash -lc "grep -i error /opt/hbase/logs/*.log | tail 
-20"
+
+# Tail live logs (run from repo root)
+docker compose -f docker/hbase/docker-compose.hbase.yml logs
+```
+
+> **Known benign messages** — these are safe to ignore in standalone mode:
+> - `SASL config status: Will not attempt to authenticate using SASL (unknown 
error)` — ZooKeeper SASL is not configured; standalone HBase does not need it.
+> - `Invalid configuration, only one server specified (ignoring)` — expected 
when running a single-node ZooKeeper.
+> - `NoClassDefFoundError: org/eclipse/jetty/...` — Jetty UI dependency 
missing in the container; does not affect HBase or ZooKeeper functionality.
+
+---
+
+## Manual API Sanity (curl)
+
+These steps assume the HugeGraph server is running at `http://localhost:8080` 
with auth enabled (`admin/pa`).
+
+> **Note on Idempotency**: Schema creation calls below use `"check_exist": 
false`. Re-running is safe only when the submitted schema definition matches 
the existing one. If definitions conflict, HugeGraph returns `ExistedException`.

Review Comment:
   Fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to