Skip to content

Commit fe0980c

Browse files
JackyYangPassionyangjiaqi
andauthored
doc: add pd & hstore quickstart quick-start (#402)
* add pd hstore quickstart doc --------- Co-authored-by: yangjiaqi <jiaqi.yang@veriti@xyz>
1 parent 53532bd commit fe0980c

File tree

6 files changed

+890
-56
lines changed

6 files changed

+890
-56
lines changed
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
---
2+
title: "HugeGraph-Store Quick Start"
3+
linkTitle: "安装/构建 HugeGraph-Store"
4+
weight: 11
5+
---
6+
7+
### 1 HugeGraph-Store 概述
8+
9+
HugeGraph-Store 是 HugeGraph 分布式版本的存储节点组件,负责实际存储和管理图数据。它与 HugeGraph-PD 协同工作,共同构成 HugeGraph 的分布式存储引擎,提供高可用性和水平扩展能力。
10+
11+
### 2 依赖
12+
13+
#### 2.1 前置条件
14+
15+
- 操作系统:Linux 或 MacOS(Windows 尚未经过完整测试)
16+
- Java 版本:≥ 11
17+
- Maven 版本:≥ 3.5.0
18+
- 已部署的 HugeGraph-PD(如果是多节点部署)
19+
20+
### 3 部署
21+
22+
有两种方式可以部署 HugeGraph-Store 组件:
23+
24+
- 方式 1:下载 tar 包
25+
- 方式 2:源码编译
26+
27+
#### 3.1 下载 tar 包
28+
29+
从 Apache HugeGraph 官方下载页面下载最新版本的 HugeGraph-Store:
30+
31+
```bash
32+
# 用最新版本号替换 {version},例如 1.5.0
33+
wget https://downloads.apache.org/incubator/hugegraph/{version}/apache-hugegraph-incubating-{version}.tar.gz
34+
tar zxf apache-hugegraph-incubating-{version}.tar.gz
35+
cd apache-hugegraph-incubating-{version}/apache-hugegraph-hstore-incubating-{version}
36+
```
37+
38+
#### 3.2 源码编译
39+
40+
```bash
41+
# 1. 克隆源代码
42+
git clone https://github.com/apache/hugegraph.git
43+
44+
# 2. 编译项目
45+
cd hugegraph
46+
mvn clean install -DskipTests=true
47+
48+
# 3. 编译成功后,Store 模块的构建产物将位于
49+
# apache-hugegraph-incubating-{version}/apache-hugegraph-hstore-incubating-{version}
50+
# target/apache-hugegraph-incubating-{version}.tar.gz
51+
```
52+
53+
### 4 配置
54+
55+
Store 的主要配置文件为 `conf/application.yml`,以下是关键配置项:
56+
57+
```yaml
58+
pdserver:
59+
# PD 服务地址,多个 PD 地址用逗号分割(配置 PD 的 gRPC 端口)
60+
address: 127.0.0.1:8686
61+
62+
grpc:
63+
# gRPC 的服务地址
64+
host: 127.0.0.1
65+
port: 8500
66+
netty-server:
67+
max-inbound-message-size: 1000MB
68+
69+
raft:
70+
# raft 缓存队列大小
71+
disruptorBufferSize: 1024
72+
address: 127.0.0.1:8510
73+
max-log-file-size: 600000000000
74+
# 快照生成时间间隔,单位秒
75+
snapshotInterval: 1800
76+
77+
server:
78+
# REST 服务地址
79+
port: 8520
80+
81+
app:
82+
# 存储路径,支持多个路径,逗号分割
83+
data-path: ./storage
84+
#raft-path: ./storage
85+
86+
spring:
87+
application:
88+
name: store-node-grpc-server
89+
profiles:
90+
active: default
91+
include: pd
92+
93+
logging:
94+
config: 'file:./conf/log4j2.xml'
95+
level:
96+
root: info
97+
```
98+
99+
对于多节点部署,需要为每个 Store 节点修改以下配置:
100+
101+
1. 每个节点的 `grpc.port`(RPC 端口)
102+
2. 每个节点的 `raft.address`(Raft 协议端口)
103+
3. 每个节点的 `server.port`(REST 端口)
104+
4. 每个节点的 `app.data-path`(数据存储路径)
105+
106+
### 5 启动与停止
107+
108+
#### 5.1 启动 Store
109+
110+
确保 PD 服务已经启动,然后在 Store 安装目录下执行:
111+
112+
```bash
113+
./bin/start-hugegraph-store.sh
114+
```
115+
116+
启动成功后,可以在 `logs/hugegraph-store-server.log` 中看到类似以下的日志:
117+
118+
```
119+
2024-xx-xx xx:xx:xx [main] [INFO] o.a.h.s.n.StoreNodeApplication - Started StoreNodeApplication in x.xxx seconds (JVM running for x.xxx)
120+
```
121+
122+
#### 5.2 停止 Store
123+
124+
在 Store 安装目录下执行:
125+
126+
```bash
127+
./bin/stop-hugegraph-store.sh
128+
```
129+
130+
### 6 多节点部署示例
131+
132+
以下是一个三节点部署的配置示例:
133+
134+
#### 6.1 三节点配置参考
135+
136+
- 3 PD 节点
137+
- raft 端口: 8610, 8611, 8612
138+
- rpc 端口: 8686, 8687, 8688
139+
- rest 端口: 8620, 8621, 8622
140+
- 3 Store 节点
141+
- raft 端口: 8510, 8511, 8512
142+
- rpc 端口: 8500, 8501, 8502
143+
- rest 端口: 8520, 8521, 8522
144+
145+
#### 6.2 Store 节点配置
146+
147+
对于三个 Store 节点,每个节点的主要配置差异如下:
148+
149+
节点 A:
150+
```yaml
151+
grpc:
152+
port: 8500
153+
raft:
154+
address: 127.0.0.1:8510
155+
server:
156+
port: 8520
157+
app:
158+
data-path: ./storage-a
159+
```
160+
161+
节点 B:
162+
```yaml
163+
grpc:
164+
port: 8501
165+
raft:
166+
address: 127.0.0.1:8511
167+
server:
168+
port: 8521
169+
app:
170+
data-path: ./storage-b
171+
```
172+
173+
节点 C:
174+
```yaml
175+
grpc:
176+
port: 8502
177+
raft:
178+
address: 127.0.0.1:8512
179+
server:
180+
port: 8522
181+
app:
182+
data-path: ./storage-c
183+
```
184+
185+
所有节点都应该指向相同的 PD 集群:
186+
```yaml
187+
pdserver:
188+
address: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
189+
```
190+
191+
### 7 验证 Store 服务
192+
193+
确认 Store 服务是否正常运行:
194+
195+
```bash
196+
curl http://localhost:8520/actuator/health
197+
```
198+
199+
如果返回 `{"status":"UP"}`,则表示 Store 服务已成功启动。
200+
201+
此外,可以通过 PD 的 API 查看集群中的 Store 节点状态:
202+
203+
```bash
204+
curl http://localhost:8620/pd/api/v1/stores
205+
```
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
---
2+
title: "HugeGraph-PD Quick Start"
3+
linkTitle: "安装/构建 HugeGraph-PD"
4+
weight: 10
5+
---
6+
7+
### 1 HugeGraph-PD 概述
8+
9+
HugeGraph-PD (Placement Driver) 是 HugeGraph 分布式版本的元数据管理组件,负责管理图数据的分布和存储节点的协调。它在分布式 HugeGraph 中扮演着核心角色,维护集群状态并协调 HugeGraph-Store 存储节点。
10+
11+
### 2 依赖
12+
13+
#### 2.1 前置条件
14+
15+
- 操作系统:Linux 或 MacOS(Windows 尚未经过完整测试)
16+
- Java 版本:≥ 11
17+
- Maven 版本:≥ 3.5.0
18+
19+
### 3 部署
20+
21+
有两种方式可以部署 HugeGraph-PD 组件:
22+
23+
- 方式 1:下载 tar 包
24+
- 方式 2:源码编译
25+
26+
#### 3.1 下载 tar 包
27+
28+
从 Apache HugeGraph 官方下载页面下载最新版本的 HugeGraph-PD:
29+
30+
```bash
31+
# 用最新版本号替换 {version},例如 1.5.0
32+
wget https://downloads.apache.org/incubator/hugegraph/{version}/apache-hugegraph-incubating-{version}.tar.gz
33+
tar zxf apache-hugegraph-incubating-{version}.tar.gz
34+
cd apache-hugegraph-incubating-{version}/apache-hugegraph-pd-incubating-{version}
35+
```
36+
37+
#### 3.2 源码编译
38+
39+
```bash
40+
# 1. 克隆源代码
41+
git clone https://github.com/apache/hugegraph.git
42+
43+
# 2. 编译项目
44+
cd hugegraph
45+
mvn clean install -DskipTests=true
46+
47+
# 3. 编译成功后,PD 模块的构建产物将位于
48+
# apache-hugegraph-incubating-{version}/apache-hugegraph-pd-incubating-{version}
49+
# target/apache-hugegraph-incubating-{version}.tar.gz
50+
```
51+
52+
### 4 配置
53+
54+
PD 的主要配置文件为 `conf/application.yml`,以下是关键配置项:
55+
56+
```yaml
57+
spring:
58+
application:
59+
name: hugegraph-pd
60+
61+
grpc:
62+
# 集群模式下的 gRPC 端口
63+
port: 8686
64+
host: 127.0.0.1
65+
66+
server:
67+
# REST 服务端口号
68+
port: 8620
69+
70+
pd:
71+
# 存储路径
72+
data-path: ./pd_data
73+
# 自动扩容的检查周期(秒)
74+
patrol-interval: 1800
75+
# 初始 store 列表,在列表内的 store 自动激活
76+
initial-store-count: 1
77+
# store 的配置信息,格式为 IP:gRPC端口
78+
initial-store-list: 127.0.0.1:8500
79+
80+
raft:
81+
# 集群模式
82+
address: 127.0.0.1:8610
83+
# 集群中所有 PD 节点的 raft 地址
84+
peers-list: 127.0.0.1:8610
85+
86+
store:
87+
# store 下线时间(秒)。超过该时间,认为 store 永久不可用,分配副本到其他机器
88+
max-down-time: 172800
89+
# 是否开启 store 监控数据存储
90+
monitor_data_enabled: true
91+
# 监控数据的间隔
92+
monitor_data_interval: 1 minute
93+
# 监控数据的保留时间
94+
monitor_data_retention: 1 day
95+
initial-store-count: 1
96+
97+
partition:
98+
# 默认每个分区副本数
99+
default-shard-count: 1
100+
# 默认每机器最大副本数
101+
store-max-shard-count: 12
102+
```
103+
104+
对于多节点部署,需要修改各节点的端口和地址配置,确保各节点之间能够正常通信。
105+
106+
### 5 启动与停止
107+
108+
#### 5.1 启动 PD
109+
110+
在 PD 安装目录下执行:
111+
112+
```bash
113+
./bin/start-hugegraph-pd.sh
114+
```
115+
116+
启动成功后,可以在 `logs/hugegraph-pd-stdout.log` 中看到类似以下的日志:
117+
118+
```
119+
2024-xx-xx xx:xx:xx [main] [INFO] o.a.h.p.b.HugePDServer - Started HugePDServer in x.xxx seconds (JVM running for x.xxx)
120+
```
121+
122+
#### 5.2 停止 PD
123+
124+
在 PD 安装目录下执行:
125+
126+
```bash
127+
./bin/stop-hugegraph-pd.sh
128+
```
129+
130+
### 6 验证
131+
132+
确认 PD 服务是否正常运行:
133+
134+
```bash
135+
curl http://localhost:8620/actuator/health
136+
```
137+
138+
如果返回 `{"status":"UP"}`,则表示 PD 服务已成功启动。

0 commit comments

Comments
 (0)