diff --git a/content/cn/docs/clients/restful-api/graphs.md b/content/cn/docs/clients/restful-api/graphs.md index 5229a9432..2dfec1c4b 100644 --- a/content/cn/docs/clients/restful-api/graphs.md +++ b/content/cn/docs/clients/restful-api/graphs.md @@ -112,19 +112,19 @@ DELETE http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/clear?confirm_ ##### Method & Url ``` -POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph_clone?clone_graph_name=hugegraph +POST http://localhost:8080/graphspaces/DEFAULT/graphs/cloneGraph?clone_graph_name=hugegraph ``` ##### Request Body (可选) 克隆一个非鉴权模式的图(设置 `Content-Type: application/json`) -```json +```javascript { "gremlin.graph": "org.apache.hugegraph.HugeFactory", "backend": "rocksdb", "serializer": "binary", - "store": "hugegraph_clone", + "store": "cloneGraph", "rocksdb.data_path": "./rks-data-xx", "rocksdb.wal_path": "./rks-data-xx" } @@ -144,7 +144,7 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph_clone?clone_grap ```javascript { - "name": "hugegraph_clone", + "name": "cloneGraph", "backend": "rocksdb" } ``` @@ -166,11 +166,21 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph-xx ##### Request Body -创建一个非鉴权模式的图(设置 `Content-Type: application/json`) +创建一个图(设置 `Content-Type: application/json`) + +**`gremlin.graph` 配置说明:** +- 鉴权模式:`"gremlin.graph": "org.apache.hugegraph.auth.HugeFactoryAuthProxy"`(推荐) +- 非鉴权模式:`"gremlin.graph": "org.apache.hugegraph.HugeFactory"` + +**注意**!! +1. 在 1.7.0 版本中,动态创建图会导致 NPE 错误。该问题已在 [PR#2912](https://github.com/apache/incubator-hugegraph/pull/2912) 中修复。当前 master 版本和 1.7.0 之前的版本不受此问题影响。 +2. 1.7.0 及之前版本,如果 backend 是 hstore,必须在请求体加上 "task.scheduler_type": "distributed"。同时请确保 HugeGraph-Server 已正确配置 PD,参见 [HStore 配置](/cn/docs/quickstart/hugegraph/hugegraph-server/#511-分布式存储hstore)。 -```json +**RocksDB 示例:** + +```javascript { - "gremlin.graph": "org.apache.hugegraph.HugeFactory", + "gremlin.graph": "org.apache.hugegraph.auth.HugeFactoryAuthProxy", "backend": "rocksdb", "serializer": "binary", "store": "hugegraph", @@ -179,9 +189,20 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph-xx } ``` -> Note: -> 1. Rocksdb 存储路径不能与现有图相同(需使用不同的目录) -> 2. 如需开启新图的权限系统,需替换设置 `gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy` +**HStore 示例(适用于 1.7.0 及之前版本):** + +```javascript +{ + "gremlin.graph": "org.apache.hugegraph.auth.HugeFactoryAuthProxy", + "backend": "hstore", + "serializer": "binary", + "store": "hugegraph2", + "task.scheduler_type": "distributed", + "pd.peers": "127.0.0.1:8686" +} +``` + +> Note: Rocksdb 存储路径不能与现有图相同(需使用不同的目录) ##### Response Status @@ -216,7 +237,7 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph-xx ##### Method & Url ```javascript -DELETE http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph_clone?confirm_message=I%27m%20sure%20to%20drop%20the%20graph +DELETE http://localhost:8080/graphspaces/DEFAULT/graphs/graphA?confirm_message=I%27m%20sure%20to%20drop%20the%20graph ``` ##### Response Status @@ -486,4 +507,4 @@ PUT http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/compact "local": "OK" } } -``` +``` \ No newline at end of file diff --git a/content/cn/docs/quickstart/hugegraph/hugegraph-server.md b/content/cn/docs/quickstart/hugegraph/hugegraph-server.md index a0606b94d..d1deef244 100644 --- a/content/cn/docs/quickstart/hugegraph/hugegraph-server.md +++ b/content/cn/docs/quickstart/hugegraph/hugegraph-server.md @@ -200,10 +200,29 @@ task.scheduler_type=distributed pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 ``` +```properties +# 简单示例(带鉴权) +gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy + +# 指定存储 hstore(必须) +backend=hstore +serializer=binary +store=hugegraph + +# 指定任务调度器(1.7.0及之前,hstore 存储必须) +task.scheduler_type=distributed + +# pd config +pd.peers=127.0.0.1:8686 +``` + 2. 修改 HugeGraph-Server 的 `rest-server.properties` 配置: ```properties usePD=true + +# 若需要 auth +# auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator ``` 如果配置多个 HugeGraph-Server 节点,需要为每个节点修改 `rest-server.properties` 配置文件,例如: @@ -213,6 +232,7 @@ usePD=true usePD=true restserver.url=http://127.0.0.1:8081 gremlinserver.url=http://127.0.0.1:8181 +pd.peers=127.0.0.1:8686 rpc.server_host=127.0.0.1 rpc.server_port=8091 @@ -226,6 +246,7 @@ server.role=master usePD=true restserver.url=http://127.0.0.1:8082 gremlinserver.url=http://127.0.0.1:8182 +pd.peers=127.0.0.1:8686 rpc.server_host=127.0.0.1 rpc.server_port=8092 diff --git a/content/en/docs/clients/restful-api/graphs.md b/content/en/docs/clients/restful-api/graphs.md index 913d8ae2a..899f1a67c 100644 --- a/content/en/docs/clients/restful-api/graphs.md +++ b/content/en/docs/clients/restful-api/graphs.md @@ -112,25 +112,25 @@ DELETE http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/clear?confirm_ ##### Method & Url ``` -POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph_clone?clone_graph_name=hugegraph +POST http://localhost:8080/graphspaces/DEFAULT/graphs/cloneGraph?clone_graph_name=hugegraph ``` ##### Request Body [Optional] Clone a `non-auth` mode graph (set `Content-Type: application/json`) -```json +```javascript { "gremlin.graph": "org.apache.hugegraph.HugeFactory", "backend": "rocksdb", "serializer": "binary", - "store": "hugegraph", + "store": "cloneGraph", "rocksdb.data_path": "./rks-data-xx", "rocksdb.wal_path": "./rks-data-xx" } ``` -> Note: +> Note: > 1. The data/wal_path can't be the same as the existing graph (use separate directories) > 2. Replace "gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy" to enable auth mode @@ -144,8 +144,8 @@ Clone a `non-auth` mode graph (set `Content-Type: application/json`) ```javascript { - "name": "hugegraph_clone", - "backend": "rocksdb" + "name": "cloneGraph", + "backend": "rocksdb" } ``` @@ -166,11 +166,21 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph2 ##### Request Body -Create a non-auth graph (set `Content-Type: application/json`) +Create a graph (set `Content-Type: application/json`) + +**`gremlin.graph` Configuration:** +- Auth mode: `"gremlin.graph": "org.apache.hugegraph.auth.HugeFactoryAuthProxy"` (Recommended) +- Non-auth mode: `"gremlin.graph": "org.apache.hugegraph.HugeFactory"` + +**Note**!! +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. +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). + +**RocksDB Example:** -```json +```javascript { - "gremlin.graph": "org.apache.hugegraph.HugeFactory", + "gremlin.graph": "org.apache.hugegraph.auth.HugeFactoryAuthProxy", "backend": "rocksdb", "serializer": "binary", "store": "hugegraph2", @@ -179,9 +189,20 @@ Create a non-auth graph (set `Content-Type: application/json`) } ``` -> Note: -> 1. The data/wal_path can't be the same as the existing graph (use separate directories) -> 2. Replace "gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy" to enable auth mode +**HStore Example (for version 1.7.0 and earlier):** + +```javascript +{ + "gremlin.graph": "org.apache.hugegraph.auth.HugeFactoryAuthProxy", + "backend": "hstore", + "serializer": "binary", + "store": "hugegraph2", + "task.scheduler_type": "distributed", + "pd.peers": "127.0.0.1:8686" +} +``` + +> Note: The data/wal_path can't be the same as the existing graph (use separate directories) ##### Response Status @@ -216,7 +237,7 @@ Since deleting a graph is a dangerous operation, we have added parameters for co ##### Method & Url ``` -DELETE http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph_clone?confirm_message=I%27m%20sure%20to%20drop%20the%20graph +DELETE http://localhost:8080/graphspaces/DEFAULT/graphs/graphA?confirm_message=I%27m%20sure%20to%20drop%20the%20graph ``` ##### Response Status diff --git a/content/en/docs/quickstart/hugegraph/hugegraph-server.md b/content/en/docs/quickstart/hugegraph/hugegraph-server.md index 226238ae2..2db777070 100644 --- a/content/en/docs/quickstart/hugegraph/hugegraph-server.md +++ b/content/en/docs/quickstart/hugegraph/hugegraph-server.md @@ -216,10 +216,29 @@ task.scheduler_type=distributed pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 ``` +```properties +# Simple example (with authentication) +gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy + +# Specify storage backend hstore +backend=hstore +serializer=binary +store=hugegraph + +# Specify the task scheduler (for versions 1.7.0 and earlier, hstore storage is required) +task.scheduler_type=distributed + +# pd config +pd.peers=127.0.0.1:8686 +``` + Then enable PD discovery in `rest-server.properties` (required for every HugeGraph-Server node): ```properties usePD=true + +# If auth is needed +# auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator ``` 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): usePD=true restserver.url=http://127.0.0.1:8081 gremlinserver.url=http://127.0.0.1:8181 +pd.peers=127.0.0.1:8686 rpc.server_host=127.0.0.1 rpc.server_port=8091 @@ -242,6 +262,7 @@ Node 2 (Worker node): usePD=true restserver.url=http://127.0.0.1:8082 gremlinserver.url=http://127.0.0.1:8182 +pd.peers=127.0.0.1:8686 rpc.server_host=127.0.0.1 rpc.server_port=8092