Skip to content
This repository was archived by the owner on Dec 28, 2025. It is now read-only.
Closed
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
219 changes: 206 additions & 13 deletions content/cn/docs/quickstart/computing/hugegraph-vermeer.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,144 @@ master 是负责通信、转发、汇总的节点,计算量和占用资源量

### 1.2 运行方法

1. **方案一:Docker Compose(推荐)**

确保docker-compose.yaml存在于您的项目根目录中。如果没有,以下是一个示例:
```yaml
#
# 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.
#

version: '3.8'

services:
vermeer-master:
image: hugegraph/vermeer
container_name: vermeer-master
volumes:
- ~/:/go/bin/config # Change here to your actual config path
command: --env=master
networks:
vermeer_network:
ipv4_address: 172.20.0.10 # Assign a static IP for the master

vermeer-worker:
image: hugegraph/vermeer
container_name: vermeer-worker
volumes:
- ~/:/go/bin/config # Change here to your actual config path
command: --env=worker
networks:
vermeer_network:
ipv4_address: 172.20.0.11 # Assign a static IP for the worker

networks:
vermeer_network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/24 # Define the subnet for your network
```

修改 docker-compose.yaml
- **Volume**:例如将两处 ~/:/go/bin/config 改为 /home/user/config:/go/bin/config(或您自己的配置目录)。
- **Subnet**:根据实际情况修改子网IP。请注意,每个容器需要访问的端口在config文件中指定,具体请参照项目`config`文件夹下内容。

在项目目录构建镜像并启动(或者先用 docker build 再 docker-compose up)

```shell
# 构建镜像(在项目根 vermeer 目录)
docker build -t hugegraph/vermeer .

# 启动(在 vermeer 根目录)
docker-compose up -d
# 或使用新版 CLI:
# docker compose up -d
```

查看日志 / 停止 / 删除:

```shell
docker-compose logs -f
docker-compose down
```

2. **方案二:通过 docker run 单独启动(手动创建网络并分配静态 IP)**

确保CONFIG_DIR对Docker进程具有适当的读取/执行权限。

构建镜像:

```shell
docker build -t hugegraph/vermeer .
```

创建自定义 bridge 网络(一次性操作):

```shell
docker network create --driver bridge \
--subnet 172.20.0.0/24 \
vermeer_network
```

运行 master(调整 CONFIG_DIR 为您的绝对配置路径,可以根据实际情况调整IP):

```shell
CONFIG_DIR=/home/user/config

docker run -d \
--name vermeer-master \
--network vermeer_network --ip 172.20.0.10 \
-v ${CONFIG_DIR}:/go/bin/config \
hugegraph/vermeer \
--env=master
```

运行 worker:

```shell
docker run -d \
--name vermeer-worker \
--network vermeer_network --ip 172.20.0.11 \
-v ${CONFIG_DIR}:/go/bin/config \
hugegraph/vermeer \
--env=worker
```

查看日志 / 停止 / 删除:

```shell
docker logs -f vermeer-master
docker logs -f vermeer-worker

docker stop vermeer-master vermeer-worker
docker rm vermeer-master vermeer-worker

# 删除自定义网络(如果需要)
docker network rm vermeer_network
```

3. **方案三:从源码构建**

构建。具体请参照[Vermeer Readme](https://github.com/apache/incubator-hugegraph-computer/tree/master/vermeer)。

```shell
go build
```

在进入文件夹目录后输入 `./vermeer --env=master` 或 `./vermeer --env=worker01`

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

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

request 示例:
vermeer提供三种加载方式:

1. 从本地加载

**request 示例:**

```javascript
POST http://localhost:8688/tasks/create
{
"task_type": "load",
"graph": "testdb",
"params": {
"load.parallel": "50",
"load.type": "local",
"load.vertex_files": "{\"localhost\":\"data/twitter-2010.v_[0,99]\"}",
"load.edge_files": "{\"localhost\":\"data/twitter-2010.e_[0,99]\"}",
"load.use_out_degree": "1",
"load.use_outedge": "1"
"load.parallel": "50",
"load.type": "local",
"load.vertex_files": "{\"localhost\":\"data/twitter-2010.v_[0,99]\"}",
"load.edge_files": "{\"localhost\":\"data/twitter-2010.e_[0,99]\"}",
"load.use_out_degree": "1",
"load.use_outedge": "1"
}
}
```

2. 从hugegraph加载

**request 示例:**

⚠️ 安全警告:切勿在配置文件或代码中存储真实密码。请改用环境变量或安全的凭据管理系统。

```javascript
POST http://localhost:8688/tasks/create
{
"task_type": "load",
"graph": "testdb",
"params": {
"load.parallel": "50",
"load.type": "hugegraph",
"load.hg_pd_peers": "[\"<your-hugegraph-ip>:8686\"]",
"load.hugegraph_name": "DEFAULT/hugegraph2/g",
"load.hugegraph_username": "admin",
"load.hugegraph_password": "<your-password-here>",
"load.use_out_degree": "1",
"load.use_outedge": "1"
}
}
```

3. 从hdfs加载

**request 示例:**

```javascript
POST http://localhost:8688/tasks/create
{
"task_type": "load",
"graph": "testdb",
"params": {
"load.parallel": "50",
"load.type": "hdfs",
"load.hdfs_namenode": "name_node1:9000",
"load.hdfs_conf_path": "/path/to/conf",
"load.krb_realm": "EXAMPLE.COM",
"load.krb_name": "user@EXAMPLE.COM",
"load.krb_keytab_path": "/path/to/keytab",
"load.krb_conf_path": "/path/to/krb5.conf",
"load.hdfs_use_krb": "1",
"load.vertex_files": "/data/graph/vertices",
"load.edge_files": "/data/graph/edges",
"load.use_out_degree": "1",
"load.use_outedge": "1"
}
}
```

### 2.3 输出计算结果

所有的 vermeer 计算任务均支持多种结果输出方式,可自定义输出方式:local、hdfs、afs 或 hugegraph,在发送请求时的 params 参数下加入对应参数,即可生效。指定 output.need_statistics 为 1 时,支持计算结果统计信息输出,结果会写在接口任务信息内。统计模式算子目前支持 "count" 和 "modularity" 。但仅针对社区发现算法适用。
Expand All @@ -66,13 +259,13 @@ POST http://localhost:8688/tasks/create
"graph": "testdb",
"params": {
"compute.algorithm": "pagerank",
"compute.parallel":"10",
"compute.max_step":"10",
"output.type":"local",
"output.parallel":"1",
"output.file_path":"result/pagerank"
"compute.parallel": "10",
"compute.max_step": "10",
"output.type": "local",
"output.parallel": "1",
"output.file_path": "result/pagerank"
}
}
}
```

## 三、支持的算法
Expand Down
Loading