-
Notifications
You must be signed in to change notification settings - Fork 115
doc: add docker-compose guide and update deployment docs #455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
imbajin
merged 17 commits into
apache:master
from
bitflicker64:docs/hugegraph-doc-docker-bridge
Apr 7, 2026
Merged
Changes from 3 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
25a7086
doc: add Docker bridge networking guide and update deployment docs
bitflicker64 6b07431
doc: add PASSWORD auth note to Docker quickstart section
bitflicker64 445988e
docs: pin HUGEGRAPH_VERSION, fix image tags, remove stale clone worka…
bitflicker64 42f7476
docs: fix front matter typo, restore Way2 clone command
bitflicker64 8d30efa
docs: fix compose filename typo, restore git clone in source build se…
bitflicker64 bf9de46
docs: sync CN files - pin HUGEGRAPH_VERSION, fix image tags, restore …
bitflicker64 e970bbc
docs: restore git clone in CN source build sections
bitflicker64 989b639
docs: revert HUGEGRAPH_VERSION prefix from deprecated Cassandra section
bitflicker64 0ed1498
Merge branch 'apache:master' into docs/hugegraph-doc-docker-bridge
bitflicker64 ae63fce
docs: add docker logs tip to Docker deployment sections
bitflicker64 d1fbee8
docs: unify compose cd path to hugegraph/docker across all EN docs
bitflicker64 d04a001
docs: sync CN files with EN updates
bitflicker64 f454c8c
docs: update Docker Compose cluster guidance
imbajin 40a818e
docs: polish HugeGraph quickstart pages
imbajin fa53ee2
Apply suggestions from code review
imbajin 353877c
Lower heading level
imbajin 9f45510
Apply suggestions from code review
imbajin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| --- | ||
| title: "HugeGraph Docker 集群部署指南" | ||
| linkTitle: "Docker 集群" | ||
| weight: 5 | ||
| --- | ||
|
|
||
| ## 概述 | ||
|
|
||
| HugeGraph 支持通过 Docker 桥接网络运行完整的分布式集群(PD + Store + Server)。该方式适用于 Linux 和 Mac(Docker Desktop)。 | ||
|
|
||
| 早期版本使用 `network_mode: host`,仅在 Linux 上可用。集群现在使用 Docker 桥接网络(`hg-net`),服务通过容器主机名而非 `127.0.0.1` 进行通信。 | ||
|
|
||
| ## 前置条件 | ||
|
|
||
| - Docker Engine 20.10+ 或 Docker Desktop 4.x+ | ||
| - Docker Compose v2 | ||
| - 3 节点集群需为 Docker Desktop 分配至少 **12 GB** 内存(设置 → 资源 → 内存) | ||
| - 本地克隆仓库(在更新后的镜像发布到 Docker Hub 之前的临时要求) | ||
|
|
||
| > **已测试平台**:Linux(原生 Docker)和 macOS(Docker Desktop,已在 Apple M4 上测试)。Windows Docker Desktop 未经测试。 | ||
|
|
||
| ## Compose 文件 | ||
|
|
||
| [`docker/`](https://github.com/apache/hugegraph/tree/master/docker) 目录下提供了三个 compose 文件: | ||
|
|
||
| | 文件 | 描述 | | ||
| |------|------| | ||
| | `docker-compose.yml` | 使用预构建镜像的单节点快速启动 | | ||
| | `docker-compose-dev.yml` | 从源码构建的单节点开发模式 | | ||
| | `docker-compose-3pd-3store-3server.yml` | 3 节点分布式集群 | | ||
|
|
||
| ## 单节点快速启动 | ||
|
|
||
| ```bash | ||
| git clone https://github.com/apache/hugegraph.git | ||
| cd hugegraph/docker | ||
| docker compose up -d | ||
| ``` | ||
imbajin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 验证: | ||
| ```bash | ||
| curl http://localhost:8080/versions | ||
| ``` | ||
|
|
||
| ## 3 节点集群快速启动 | ||
|
|
||
| ```bash | ||
| cd hugegraph/docker | ||
| docker compose -f docker-compose-3pd-3store-3server.yml up -d | ||
| ``` | ||
|
|
||
| 启动顺序自动强制执行: | ||
| 1. PD 节点首先启动,必须通过 `/v1/health` 健康检查 | ||
| 2. Store 节点在所有 PD 节点健康后启动 | ||
| 3. Server 节点在所有 Store 节点健康后启动 | ||
|
|
||
| 验证集群: | ||
| ```bash | ||
| curl http://localhost:8620/v1/health # PD 健康检查 | ||
| curl http://localhost:8520/v1/health # Store 健康检查 | ||
| curl http://localhost:8080/versions # Server | ||
| curl http://localhost:8620/v1/stores # 已注册的 Store | ||
| curl http://localhost:8620/v1/partitions # 分区分配 | ||
bitflicker64 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
imbajin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## 环境变量参考 | ||
|
|
||
| ### PD 变量 | ||
|
|
||
| | 变量 | 必填 | 默认值 | 映射配置 | | ||
| |------|------|--------|----------| | ||
| | `HG_PD_GRPC_HOST` | 是 | — | `grpc.host` | | ||
| | `HG_PD_RAFT_ADDRESS` | 是 | — | `raft.address` | | ||
| | `HG_PD_RAFT_PEERS_LIST` | 是 | — | `raft.peers-list` | | ||
| | `HG_PD_INITIAL_STORE_LIST` | 是 | — | `pd.initial-store-list` | | ||
| | `HG_PD_GRPC_PORT` | 否 | `8686` | `grpc.port` | | ||
| | `HG_PD_REST_PORT` | 否 | `8620` | `server.port` | | ||
| | `HG_PD_DATA_PATH` | 否 | `/hugegraph-pd/pd_data` | `pd.data-path` | | ||
| | `HG_PD_INITIAL_STORE_COUNT` | 否 | `1` | `pd.initial-store-count` | | ||
|
|
||
| **已弃用的别名**:`GRPC_HOST` → `HG_PD_GRPC_HOST`、`RAFT_ADDRESS` → `HG_PD_RAFT_ADDRESS`、`RAFT_PEERS` → `HG_PD_RAFT_PEERS_LIST` | ||
|
|
||
| ### Store 变量 | ||
|
|
||
| | 变量 | 必填 | 默认值 | 映射配置 | | ||
| |------|------|--------|----------| | ||
| | `HG_STORE_PD_ADDRESS` | 是 | — | `pdserver.address` | | ||
| | `HG_STORE_GRPC_HOST` | 是 | — | `grpc.host` | | ||
| | `HG_STORE_RAFT_ADDRESS` | 是 | — | `raft.address` | | ||
| | `HG_STORE_GRPC_PORT` | 否 | `8500` | `grpc.port` | | ||
| | `HG_STORE_REST_PORT` | 否 | `8520` | `server.port` | | ||
| | `HG_STORE_DATA_PATH` | 否 | `/hugegraph-store/storage` | `app.data-path` | | ||
|
|
||
| **已弃用的别名**:`PD_ADDRESS` → `HG_STORE_PD_ADDRESS`、`GRPC_HOST` → `HG_STORE_GRPC_HOST`、`RAFT_ADDRESS` → `HG_STORE_RAFT_ADDRESS` | ||
|
|
||
| ### Server 变量 | ||
|
|
||
| | 变量 | 必填 | 默认值 | 映射配置 | | ||
| |------|------|--------|----------| | ||
| | `HG_SERVER_BACKEND` | 是 | — | `hugegraph.properties` 中的 `backend` | | ||
| | `HG_SERVER_PD_PEERS` | 是 | — | `pd.peers` | | ||
| | `STORE_REST` | 否 | — | `wait-partition.sh` 使用 | | ||
| | `PASSWORD` | 否 | — | 启用鉴权模式 | | ||
|
|
||
| **已弃用的别名**:`BACKEND` → `HG_SERVER_BACKEND`、`PD_PEERS` → `HG_SERVER_PD_PEERS` | ||
|
|
||
| ## 端口参考 | ||
|
|
||
| | 服务 | 宿主机端口 | 用途 | | ||
| |------|-----------|------| | ||
| | pd0 | 8620 | REST API | | ||
| | pd0 | 8686 | gRPC | | ||
| | pd1 | 8621 | REST API | | ||
| | pd1 | 8687 | gRPC | | ||
| | pd2 | 8622 | REST API | | ||
| | pd2 | 8688 | gRPC | | ||
| | store0 | 8500 | gRPC | | ||
| | store0 | 8520 | REST API | | ||
| | store1 | 8501 | gRPC | | ||
| | store1 | 8521 | REST API | | ||
| | store2 | 8502 | gRPC | | ||
| | store2 | 8522 | REST API | | ||
| | server0 | 8080 | Graph API | | ||
| | server1 | 8081 | Graph API | | ||
| | server2 | 8082 | Graph API | | ||
|
|
||
| ## 故障排查 | ||
|
|
||
| **容器 OOM 被杀(退出码 137)**:将 Docker Desktop 内存增加到 12 GB 以上。 | ||
|
|
||
| **Raft 选举超时**:检查所有 PD 节点的 `HG_PD_RAFT_PEERS_LIST` 是否一致。验证连通性:`docker exec hg-pd0 ping pd1` | ||
bitflicker64 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| **分区分配未完成**:检查 `curl http://localhost:8620/v1/stores` — 所有 3 个 Store 必须显示 `"state":"Up"` 才能完成分区分配。 | ||
|
|
||
| **连接被拒**:确保 `HG_*` 环境变量使用容器主机名(`pd0`、`store0`),而非 `127.0.0.1`。 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.