Skip to content
This repository was archived by the owner on Dec 28, 2025. It is now read-only.

Commit 8660ca6

Browse files
committed
chore: add docker using / add load data methods
1 parent c7c457a commit 8660ca6

File tree

2 files changed

+300
-14
lines changed

2 files changed

+300
-14
lines changed

content/cn/docs/quickstart/computing/hugegraph-vermeer.md

Lines changed: 150 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,94 @@ master 是负责通信、转发、汇总的节点,计算量和占用资源量
1616

1717
### 1.2 运行方法
1818

19+
1. **方案一:Docker Compose(推荐)**
20+
21+
确保docker-compose.yaml存在于您的项目目录中。如果没有,你需要根据项目的docker-compose.yaml模板创建一个。
22+
23+
修改 docker-compose.yaml 中的 volume,例如将两处 ~/:/go/bin/config 改为 /home/user/config:/go/bin/config(或你自己的配置目录)。
24+
在项目目录构建镜像并启动(或者先用 docker build 再 docker-compose up)
25+
26+
```shell
27+
# 构建镜像(在项目根 vermeer 目录)
28+
docker build -t hugegraph/vermeer .
29+
30+
# 启动(在含 docker-compose.yaml 的目录)
31+
docker-compose up -d
32+
# 或使用新版 CLI:
33+
# docker compose up -d
34+
```
35+
36+
查看日志 / 停止 / 删除:
37+
38+
```shell
39+
docker-compose logs -f
40+
docker-compose down
41+
```
42+
43+
2. **方案二:通过 docker run 单独启动(手动创建网络并分配静态 IP)**
44+
45+
确保CONFIG_DIR对Docker进程具有适当的读取/执行权限(例如chmod 755 CONFIG_DIR)。
46+
47+
构建镜像:
48+
49+
```shell
50+
docker build -t hugegraph/vermeer .
51+
```
52+
53+
创建自定义 bridge 网络(一次性操作):
54+
55+
```shell
56+
docker network create --driver bridge \
57+
--subnet 172.20.0.0/24 \
58+
vermeer_network
59+
```
60+
61+
运行 master(示例将容器 8080 映射到宿主机 8080;调整 CONFIG_DIR 为你的绝对配置路径):
62+
63+
```shell
64+
CONFIG_DIR=/home/user/config
65+
66+
docker run -d \
67+
--name vermeer-master \
68+
--network vermeer_network --ip 172.20.0.10 \
69+
-v ${CONFIG_DIR}:/go/bin/config \
70+
-p 8080:8080 \
71+
hugegraph/vermeer \
72+
--env=master
73+
```
74+
75+
运行 worker:
76+
77+
```shell
78+
docker run -d \
79+
--name vermeer-worker \
80+
--network vermeer_network --ip 172.20.0.11 \
81+
-v ${CONFIG_DIR}:/go/bin/config \
82+
hugegraph/vermeer \
83+
--env=worker
84+
```
85+
86+
查看日志 / 停止 / 删除:
87+
88+
```shell
89+
docker logs -f vermeer-master
90+
docker logs -f vermeer-worker
91+
92+
docker stop vermeer-master vermeer-worker
93+
docker rm vermeer-master vermeer-worker
94+
95+
# 删除自定义网络(如果需要)
96+
docker network rm vermeer_network
97+
```
98+
99+
3. **方案三:从源码构建**
100+
101+
构建
102+
103+
```shell
104+
go build
105+
```
106+
19107
在进入文件夹目录后输入 `./vermeer --env=master``./vermeer --env=worker01`
20108

21109
## 二、任务创建类 rest api
@@ -33,24 +121,79 @@ master 是负责通信、转发、汇总的节点,计算量和占用资源量
33121

34122
具体参数参考 Vermeer 参数列表文档。
35123

36-
request 示例:
124+
vermeer提供三种加载方式:
125+
126+
1. 从本地加载
127+
128+
**request 示例:**
37129

38130
```javascript
39131
POST http://localhost:8688/tasks/create
40132
{
41133
"task_type": "load",
42134
"graph": "testdb",
43135
"params": {
44-
"load.parallel": "50",
45-
"load.type": "local",
46-
"load.vertex_files": "{\"localhost\":\"data/twitter-2010.v_[0,99]\"}",
47-
"load.edge_files": "{\"localhost\":\"data/twitter-2010.e_[0,99]\"}",
48-
"load.use_out_degree": "1",
49-
"load.use_outedge": "1"
136+
"load.parallel": "50",
137+
"load.type": "local",
138+
"load.vertex_files": "{\"localhost\":\"data/twitter-2010.v_[0,99]\"}",
139+
"load.edge_files": "{\"localhost\":\"data/twitter-2010.e_[0,99]\"}",
140+
"load.use_out_degree": "1",
141+
"load.use_outedge": "1"
50142
}
51143
}
52144
```
53145

146+
2. 从hugegraph加载
147+
148+
**request 示例:**
149+
150+
⚠️ 安全警告:切勿在配置文件或代码中存储真实密码。请改用环境变量或安全的凭据管理系统。
151+
152+
```javascript
153+
POST http://localhost:8688/tasks/create
154+
{
155+
"task_type": "load",
156+
"graph": "testdb",
157+
"params": {
158+
"load.parallel": "50",
159+
"load.type": "hugegraph",
160+
"load.hg_pd_peers": "[\"10.14.139.69:8686\"]",
161+
"load.hugegraph_name": "DEFAULT/hugegraph2/g",
162+
"load.hugegraph_username":"admin",
163+
"load.hugegraph_password":"xxxxx",
164+
"load.use_out_degree": "1",
165+
"load.use_outedge": "1"
166+
}
167+
}
168+
```
169+
170+
3. 从hdfs加载
171+
172+
**request 示例:**
173+
174+
```javascript
175+
POST http://localhost:8688/tasks/create
176+
{
177+
"task_type": "load",
178+
"graph": "testdb",
179+
"params": {
180+
"load.parallel": "50",
181+
"load.type": "hdfs",
182+
"load.hdfs_namenode": "name_node",
183+
"load.hdfs_conf_path": "path",
184+
"load.krb_realm":"admin",
185+
"load.krb_name":"xxxxx",
186+
"load.krb_keytab_path":"path",
187+
"load.krb_conf_path":"path",
188+
"load.hdfs_use_krb":"1",
189+
"load.vertex_files":"path",
190+
"load.edge_files":"path",
191+
"load.use_out_degree": "1",
192+
"load.use_outedge": "1"
193+
}
194+
}
195+
```
196+
54197
### 2.3 输出计算结果
55198

56199
所有的 vermeer 计算任务均支持多种结果输出方式,可自定义输出方式:local、hdfs、afs 或 hugegraph,在发送请求时的 params 参数下加入对应参数,即可生效。指定 output.need_statistics 为 1 时,支持计算结果统计信息输出,结果会写在接口任务信息内。统计模式算子目前支持 "count" 和 "modularity" 。但仅针对社区发现算法适用。

content/en/docs/quickstart/computing/hugegraph-vermeer.md

Lines changed: 150 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,94 @@ The framework's runtime configuration can be passed via command-line parameters
1616

1717
### 1.2 Running Method
1818

19+
1. **Option 1: Docker Compose (Recommended)**
20+
21+
Ensure docker-compose.yaml exists in your project directory. If not, you'll need to create one based on the project's docker-compose.yaml template.
22+
23+
Modify the volume in `docker-compose.yaml`, for example, changing the two instances of `~/:/go/bin/config` to `/home/user/config:/go/bin/config` (or your own configuration directory).
24+
Build the image and start up in the project directory (or use `docker build` first, then `docker-compose up`)
25+
26+
```shell
27+
# Build the image (in the project root 'vermeer' directory)
28+
docker build -t hugegraph/vermeer .
29+
30+
# Start up (in the directory containing docker-compose.yaml)
31+
docker-compose up -d
32+
# Or use the new CLI:
33+
# docker compose up -d
34+
```
35+
36+
View logs / Stop / Remove:
37+
38+
```shell
39+
docker-compose logs -f
40+
docker-compose down
41+
```
42+
43+
2. **Option 2: Start individually via `docker run` (Manually create network and assign static IP)**
44+
45+
Ensure the CONFIG_DIR has proper read/execute permissions for the Docker process (e.g., chmod 755 CONFIG_DIR).
46+
47+
Build the image:
48+
49+
```shell
50+
docker build -t hugegraph/vermeer .
51+
```
52+
53+
Create a custom bridge network (one-time operation):
54+
55+
```shell
56+
docker network create --driver bridge \
57+
--subnet 172.20.0.0/24 \
58+
vermeer_network
59+
```
60+
61+
Run master (Example maps container port 8080 to host port 8080; adjust `CONFIG_DIR` to your absolute configuration path):
62+
63+
```shell
64+
CONFIG_DIR=/home/user/config
65+
66+
docker run -d \
67+
--name vermeer-master \
68+
--network vermeer_network --ip 172.20.0.10 \
69+
-v ${CONFIG_DIR}:/go/bin/config \
70+
-p 8080:8080 \
71+
hugegraph/vermeer \
72+
--env=master
73+
```
74+
75+
Run worker:
76+
77+
```shell
78+
docker run -d \
79+
--name vermeer-worker \
80+
--network vermeer_network --ip 172.20.0.11 \
81+
-v ${CONFIG_DIR}:/go/bin/config \
82+
hugegraph/vermeer \
83+
--env=worker
84+
```
85+
86+
View logs / Stop / Remove:
87+
88+
```shell
89+
docker logs -f vermeer-master
90+
docker logs -f vermeer-worker
91+
92+
docker stop vermeer-master vermeer-worker
93+
docker rm vermeer-master vermeer-worker
94+
95+
# Remove the custom network (if needed)
96+
docker network rm vermeer_network
97+
```
98+
99+
3. **Option 3: Build from Source**
100+
101+
Build
102+
103+
```shell
104+
go build
105+
```
106+
19107
Enter the directory and input `./vermeer --env=master` or `./vermeer --env=worker01`.
20108

21109
## 2. Task Creation REST API
@@ -33,24 +121,79 @@ Available URLs are as follows:
33121

34122
Refer to the Vermeer parameter list document for specific parameters.
35123

36-
Request example:
124+
Vermeer provides three ways to load data:
125+
126+
1. Load from Local Files
127+
128+
**Request Example:**
37129

38130
```javascript
39131
POST http://localhost:8688/tasks/create
40132
{
41133
"task_type": "load",
42134
"graph": "testdb",
43135
"params": {
44-
"load.parallel": "50",
45-
"load.type": "local",
46-
"load.vertex_files": "{\"localhost\":\"data/twitter-2010.v_[0,99]\"}",
47-
"load.edge_files": "{\"localhost\":\"data/twitter-2010.e_[0,99]\"}",
48-
"load.use_out_degree": "1",
49-
"load.use_outedge": "1"
136+
"load.parallel": "50",
137+
"load.type": "local",
138+
"load.vertex_files": "{\"localhost\":\"data/twitter-2010.v_[0,99]\"}",
139+
"load.edge_files": "{\"localhost\":\"data/twitter-2010.e_[0,99]\"}",
140+
"load.use_out_degree": "1",
141+
"load.use_outedge": "1"
50142
}
51143
}
52144
```
53145

146+
2. Load from HugeGraph
147+
148+
**Request Example:**
149+
150+
⚠️ Security Warning: Never store real passwords in configuration files or code. Use environment variables or a secure credential management system instead.
151+
152+
```javascript
153+
POST http://localhost:8688/tasks/create
154+
{
155+
"task_type": "load",
156+
"graph": "testdb",
157+
"params": {
158+
"load.parallel": "50",
159+
"load.type": "hugegraph",
160+
"load.hg_pd_peers": "[\"10.14.139.69:8686\"]",
161+
"load.hugegraph_name": "DEFAULT/hugegraph2/g",
162+
"load.hugegraph_username":"admin",
163+
"load.hugegraph_password":"xxxxx",
164+
"load.use_out_degree": "1",
165+
"load.use_outedge": "1"
166+
}
167+
}
168+
```
169+
170+
3. Load from HDFS
171+
172+
**Request Example:**
173+
174+
```javascript
175+
POST http://localhost:8688/tasks/create
176+
{
177+
"task_type": "load",
178+
"graph": "testdb",
179+
"params": {
180+
"load.parallel": "50",
181+
"load.type": "hdfs",
182+
"load.hdfs_namenode": "name_node",
183+
"load.hdfs_conf_path": "path",
184+
"load.krb_realm":"admin",
185+
"load.krb_name":"xxxxx",
186+
"load.krb_keytab_path":"path",
187+
"load.krb_conf_path":"path",
188+
"load.hdfs_use_krb":"1",
189+
"load.vertex_files":"path",
190+
"load.edge_files":"path",
191+
"load.use_out_degree": "1",
192+
"load.use_outedge": "1"
193+
}
194+
}
195+
```
196+
54197
### 2.3 Output Computation Results
55198

56199
All Vermeer computation tasks support multiple result output methods, which can be customized: local, hdfs, afs, or hugegraph. Add the corresponding parameters under the params parameter when sending the request to take effect. When output.need_statistics is set to 1, it supports outputting statistical information of the computation results, which will be written in the interface task information. The statistical mode operators currently support "count" and "modularity," but only for community detection algorithms.

0 commit comments

Comments
 (0)