Skip to content

Commit 515fb75

Browse files
TsukilcCopilot
andauthored
docs: optimize dynamic creation of diagram documents (#444)
* fix: fix graphs.md --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 8b6aec9 commit 515fb75

File tree

4 files changed

+109
-25
lines changed

4 files changed

+109
-25
lines changed

content/cn/docs/clients/restful-api/graphs.md

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,19 @@ DELETE http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/clear?confirm_
112112
##### Method & Url
113113

114114
```
115-
POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph_clone?clone_graph_name=hugegraph
115+
POST http://localhost:8080/graphspaces/DEFAULT/graphs/cloneGraph?clone_graph_name=hugegraph
116116
```
117117

118118
##### Request Body (可选)
119119

120120
克隆一个非鉴权模式的图(设置 `Content-Type: application/json`
121121

122-
```json
122+
```javascript
123123
{
124124
"gremlin.graph": "org.apache.hugegraph.HugeFactory",
125125
"backend": "rocksdb",
126126
"serializer": "binary",
127-
"store": "hugegraph_clone",
127+
"store": "cloneGraph",
128128
"rocksdb.data_path": "./rks-data-xx",
129129
"rocksdb.wal_path": "./rks-data-xx"
130130
}
@@ -144,7 +144,7 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph_clone?clone_grap
144144

145145
```javascript
146146
{
147-
"name": "hugegraph_clone",
147+
"name": "cloneGraph",
148148
"backend": "rocksdb"
149149
}
150150
```
@@ -166,11 +166,21 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph-xx
166166

167167
##### Request Body
168168

169-
创建一个非鉴权模式的图(设置 `Content-Type: application/json`
169+
创建一个图(设置 `Content-Type: application/json`
170+
171+
**`gremlin.graph` 配置说明:**
172+
- 鉴权模式:`"gremlin.graph": "org.apache.hugegraph.auth.HugeFactoryAuthProxy"`(推荐)
173+
- 非鉴权模式:`"gremlin.graph": "org.apache.hugegraph.HugeFactory"`
174+
175+
**注意**!!
176+
1. 在 1.7.0 版本中,动态创建图会导致 NPE 错误。该问题已在 [PR#2912](https://github.com/apache/incubator-hugegraph/pull/2912) 中修复。当前 master 版本和 1.7.0 之前的版本不受此问题影响。
177+
2. 1.7.0 及之前版本,如果 backend 是 hstore,必须在请求体加上 "task.scheduler_type": "distributed"。同时请确保 HugeGraph-Server 已正确配置 PD,参见 [HStore 配置](/cn/docs/quickstart/hugegraph/hugegraph-server/#511-分布式存储hstore)
170178

171-
```json
179+
**RocksDB 示例:**
180+
181+
```javascript
172182
{
173-
"gremlin.graph": "org.apache.hugegraph.HugeFactory",
183+
"gremlin.graph": "org.apache.hugegraph.auth.HugeFactoryAuthProxy",
174184
"backend": "rocksdb",
175185
"serializer": "binary",
176186
"store": "hugegraph",
@@ -179,9 +189,20 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph-xx
179189
}
180190
```
181191

182-
> Note:
183-
> 1. Rocksdb 存储路径不能与现有图相同(需使用不同的目录)
184-
> 2. 如需开启新图的权限系统,需替换设置 `gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy`
192+
**HStore 示例(适用于 1.7.0 及之前版本):**
193+
194+
```javascript
195+
{
196+
"gremlin.graph": "org.apache.hugegraph.auth.HugeFactoryAuthProxy",
197+
"backend": "hstore",
198+
"serializer": "binary",
199+
"store": "hugegraph2",
200+
"task.scheduler_type": "distributed",
201+
"pd.peers": "127.0.0.1:8686"
202+
}
203+
```
204+
205+
> Note: Rocksdb 存储路径不能与现有图相同(需使用不同的目录)
185206
186207
##### Response Status
187208

@@ -216,7 +237,7 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph-xx
216237
##### Method & Url
217238

218239
```javascript
219-
DELETE http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph_clone?confirm_message=I%27m%20sure%20to%20drop%20the%20graph
240+
DELETE http://localhost:8080/graphspaces/DEFAULT/graphs/graphA?confirm_message=I%27m%20sure%20to%20drop%20the%20graph
220241
```
221242

222243
##### Response Status
@@ -486,4 +507,4 @@ PUT http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/compact
486507
"local": "OK"
487508
}
488509
}
489-
```
510+
```

content/cn/docs/quickstart/hugegraph/hugegraph-server.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,29 @@ task.scheduler_type=distributed
200200
pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
201201
```
202202

203+
```properties
204+
# 简单示例(带鉴权)
205+
gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy
206+
207+
# 指定存储 hstore(必须)
208+
backend=hstore
209+
serializer=binary
210+
store=hugegraph
211+
212+
# 指定任务调度器(1.7.0及之前,hstore 存储必须)
213+
task.scheduler_type=distributed
214+
215+
# pd config
216+
pd.peers=127.0.0.1:8686
217+
```
218+
203219
2. 修改 HugeGraph-Server 的 `rest-server.properties` 配置:
204220

205221
```properties
206222
usePD=true
223+
224+
# 若需要 auth
225+
# auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator
207226
```
208227

209228
如果配置多个 HugeGraph-Server 节点,需要为每个节点修改 `rest-server.properties` 配置文件,例如:
@@ -213,6 +232,7 @@ usePD=true
213232
usePD=true
214233
restserver.url=http://127.0.0.1:8081
215234
gremlinserver.url=http://127.0.0.1:8181
235+
pd.peers=127.0.0.1:8686
216236

217237
rpc.server_host=127.0.0.1
218238
rpc.server_port=8091
@@ -226,6 +246,7 @@ server.role=master
226246
usePD=true
227247
restserver.url=http://127.0.0.1:8082
228248
gremlinserver.url=http://127.0.0.1:8182
249+
pd.peers=127.0.0.1:8686
229250

230251
rpc.server_host=127.0.0.1
231252
rpc.server_port=8092

content/en/docs/clients/restful-api/graphs.md

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,25 +112,25 @@ DELETE http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/clear?confirm_
112112
##### Method & Url
113113

114114
```
115-
POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph_clone?clone_graph_name=hugegraph
115+
POST http://localhost:8080/graphspaces/DEFAULT/graphs/cloneGraph?clone_graph_name=hugegraph
116116
```
117117

118118
##### Request Body [Optional]
119119

120120
Clone a `non-auth` mode graph (set `Content-Type: application/json`)
121121

122-
```json
122+
```javascript
123123
{
124124
"gremlin.graph": "org.apache.hugegraph.HugeFactory",
125125
"backend": "rocksdb",
126126
"serializer": "binary",
127-
"store": "hugegraph",
127+
"store": "cloneGraph",
128128
"rocksdb.data_path": "./rks-data-xx",
129129
"rocksdb.wal_path": "./rks-data-xx"
130130
}
131131
```
132132

133-
> Note:
133+
> Note:
134134
> 1. The data/wal_path can't be the same as the existing graph (use separate directories)
135135
> 2. Replace "gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy" to enable auth mode
136136
@@ -144,8 +144,8 @@ Clone a `non-auth` mode graph (set `Content-Type: application/json`)
144144

145145
```javascript
146146
{
147-
"name": "hugegraph_clone",
148-
"backend": "rocksdb"
147+
"name": "cloneGraph",
148+
"backend": "rocksdb"
149149
}
150150
```
151151

@@ -166,11 +166,21 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph2
166166

167167
##### Request Body
168168

169-
Create a non-auth graph (set `Content-Type: application/json`)
169+
Create a graph (set `Content-Type: application/json`)
170+
171+
**`gremlin.graph` Configuration:**
172+
- Auth mode: `"gremlin.graph": "org.apache.hugegraph.auth.HugeFactoryAuthProxy"` (Recommended)
173+
- Non-auth mode: `"gremlin.graph": "org.apache.hugegraph.HugeFactory"`
174+
175+
**Note**!!
176+
1. In version 1.7.0, dynamic graph creation would cause a NPE. This issue has been fixed in [PR#2912](https://github.com/apache/incubator-hugegraph/pull/2912). The current master version and versions after 1.7.0 do not have this problem.
177+
2. For version 1.7.0 and earlier, if the backend is hstore, you must add "task.scheduler_type": "distributed" in the request body. Also ensure HugeGraph-Server is properly configured with PD, see [HStore Configuration](/docs/quickstart/hugegraph/hugegraph-server/#511-distributed-storage-hstore).
178+
179+
**RocksDB Example:**
170180

171-
```json
181+
```javascript
172182
{
173-
"gremlin.graph": "org.apache.hugegraph.HugeFactory",
183+
"gremlin.graph": "org.apache.hugegraph.auth.HugeFactoryAuthProxy",
174184
"backend": "rocksdb",
175185
"serializer": "binary",
176186
"store": "hugegraph2",
@@ -179,9 +189,20 @@ Create a non-auth graph (set `Content-Type: application/json`)
179189
}
180190
```
181191

182-
> Note:
183-
> 1. The data/wal_path can't be the same as the existing graph (use separate directories)
184-
> 2. Replace "gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy" to enable auth mode
192+
**HStore Example (for version 1.7.0 and earlier):**
193+
194+
```javascript
195+
{
196+
"gremlin.graph": "org.apache.hugegraph.auth.HugeFactoryAuthProxy",
197+
"backend": "hstore",
198+
"serializer": "binary",
199+
"store": "hugegraph2",
200+
"task.scheduler_type": "distributed",
201+
"pd.peers": "127.0.0.1:8686"
202+
}
203+
```
204+
205+
> Note: The data/wal_path can't be the same as the existing graph (use separate directories)
185206
186207
##### Response Status
187208

@@ -216,7 +237,7 @@ Since deleting a graph is a dangerous operation, we have added parameters for co
216237
##### Method & Url
217238

218239
```
219-
DELETE http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph_clone?confirm_message=I%27m%20sure%20to%20drop%20the%20graph
240+
DELETE http://localhost:8080/graphspaces/DEFAULT/graphs/graphA?confirm_message=I%27m%20sure%20to%20drop%20the%20graph
220241
```
221242

222243
##### Response Status

content/en/docs/quickstart/hugegraph/hugegraph-server.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,29 @@ task.scheduler_type=distributed
216216
pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
217217
```
218218

219+
```properties
220+
# Simple example (with authentication)
221+
gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy
222+
223+
# Specify storage backend hstore
224+
backend=hstore
225+
serializer=binary
226+
store=hugegraph
227+
228+
# Specify the task scheduler (for versions 1.7.0 and earlier, hstore storage is required)
229+
task.scheduler_type=distributed
230+
231+
# pd config
232+
pd.peers=127.0.0.1:8686
233+
```
234+
219235
Then enable PD discovery in `rest-server.properties` (required for every HugeGraph-Server node):
220236

221237
```properties
222238
usePD=true
239+
240+
# If auth is needed
241+
# auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator
223242
```
224243

225244
If configuring multiple HugeGraph-Server nodes, you need to modify the `rest-server.properties` configuration file for each node, for example:
@@ -229,6 +248,7 @@ Node 1 (Master node):
229248
usePD=true
230249
restserver.url=http://127.0.0.1:8081
231250
gremlinserver.url=http://127.0.0.1:8181
251+
pd.peers=127.0.0.1:8686
232252
233253
rpc.server_host=127.0.0.1
234254
rpc.server_port=8091
@@ -242,6 +262,7 @@ Node 2 (Worker node):
242262
usePD=true
243263
restserver.url=http://127.0.0.1:8082
244264
gremlinserver.url=http://127.0.0.1:8182
265+
pd.peers=127.0.0.1:8686
245266
246267
rpc.server_host=127.0.0.1
247268
rpc.server_port=8092

0 commit comments

Comments
 (0)