diff --git a/content/cn/docs/SUMMARY.md b/content/cn/docs/SUMMARY.md index 558da6720..ccd36270a 100644 --- a/content/cn/docs/SUMMARY.md +++ b/content/cn/docs/SUMMARY.md @@ -5,11 +5,11 @@ ## Quickstart * [Install HugeGraph-Server](quickstart/hugegraph-server.md) * [Load data with HugeGraph-Loader](quickstart/hugegraph-loader.md) -* [Manage with HugeGraph-Tools](quickstart/hugegraph-tools.md) * [Visual with HugeGraph-Hubble](quickstart/hugegraph-hubble.md) -* [Display with HugeGraph-Studio](quickstart/hugegraph-studio.md) * [Develop with HugeGraph-Client](quickstart/hugegraph-client.md) +* [Manage with HugeGraph-Tools](quickstart/hugegraph-tools.md) * [Analysis with HugeGraph-Computer](quickstart/hugegraph-computer.md) +* [Display with HugeGraph-Studio](quickstart/hugegraph-studio.md) ## Config * [Config Guide](config/config-guide.md) diff --git a/content/cn/docs/quickstart/hugegraph-client.md b/content/cn/docs/quickstart/hugegraph-client.md index f1fee66b0..d51db5fe5 100644 --- a/content/cn/docs/quickstart/hugegraph-client.md +++ b/content/cn/docs/quickstart/hugegraph-client.md @@ -1,7 +1,7 @@ --- title: "HugeGraph-Client Quick Start" linkTitle: "Develop with HugeGraph-Client" -weight: 6 +weight: 4 --- ### 1 HugeGraph-Client 概述 diff --git a/content/cn/docs/quickstart/hugegraph-computer.md b/content/cn/docs/quickstart/hugegraph-computer.md index 6d6ba9fce..e43d35694 100644 --- a/content/cn/docs/quickstart/hugegraph-computer.md +++ b/content/cn/docs/quickstart/hugegraph-computer.md @@ -1,7 +1,7 @@ --- title: "HugeGraph-Computer Quick Start" linkTitle: "Analysis with HugeGraph-Computer" -weight: 7 +weight: 6 --- ## 1 HugeGraph-Computer 概述 diff --git a/content/cn/docs/quickstart/hugegraph-hubble.md b/content/cn/docs/quickstart/hugegraph-hubble.md index eb76cd3ae..ba5017a3d 100644 --- a/content/cn/docs/quickstart/hugegraph-hubble.md +++ b/content/cn/docs/quickstart/hugegraph-hubble.md @@ -1,7 +1,7 @@ --- title: "HugeGraph-Hubble Quick Start" linkTitle: "Visual with HugeGraph-Hubble" -weight: 4 +weight: 3 --- ### 1 HugeGraph-Hubble概述 @@ -32,14 +32,40 @@ HugeGraph是一款面向分析型,支持批量操作的图数据库系统, 对于需要遍历全图的Gremlin任务,索引的创建与重建等耗时较长的异步任务,平台提供相应的任务管理功能,实现异步任务的统一的管理与结果查看。 -#### 2 部署 +### 2 部署 有三种方式可以部署`hugegraph-hubble` +- 使用docker (推荐) - 下载 toolchain 二进制包 - 源码编译 -- 使用docker -#### 2.1 下载 toolchain 二进制包 +#### 2.1 使用Docker (推荐) + +> **特别注意**: 如果使用 docker 启动 hubble,且 hubble 和 server 位于同一宿主机,在后续 hubble 页面中设置 graph 的 hostname 的时候请不要直接设置 `localhost/127.0.0.1`,这将指向 hubble 容器内部而非宿主机,导致无法连接到 server + +我们可以使用 `docker run -itd --name=hubble -p 8088:8088 hugegraph/hubble` 快速启动 [hubble](https://hub.docker.com/r/hugegraph/hubble). + +或者使用docker-compose启动hubble,另外如果hubble和graph在同一个docker网络下,可以使用graph的contain_name进行访问,而不需要宿主机的ip + +使用`docker-compose up -d`,`docker-compose.yml`如下: + +```yaml +version: '3' +services: + server: + image: hugegraph/hugegraph + container_name: graph + ports: + - 18080:8080 + + hubble: + image: hugegraph/hubble + container_name: hubble + ports: + - 8088:8088 +``` + +#### 2.2 下载 toolchain 二进制包 `hubble`项目在`toolchain`项目中, 首先下载`toolchain`的tar包 @@ -68,7 +94,7 @@ starting HugeGraphHubble ..............timed out with http status 502 然后使用浏览器访问 `ip:8088` 可看到`hubble`页面, 通过`bin/stop-hubble.sh`则可以停止服务 -#### 2.2 源码编译 +#### 2.3 源码编译 **注意:** 编译 hubble 需要用户本地环境有安装 `Nodejs V16.x` 与 `yarn` 环境 @@ -114,32 +140,6 @@ cd apache-hugegraph-hubble-incubating* bin/start-hubble.sh -d ``` -#### 2.3 使用Docker - -> **特别注意**: 如果使用 docker 启动 hubble,且 hubble 和 server 位于同一宿主机,在后续 hubble 页面中设置 graph 的 hostname 的时候请不要直接设置 `localhost/127.0.0.1`,这将指向 hubble 容器内部而非宿主机,导致无法连接到 server - -我们可以使用 `docker run -itd --name=hubble -p 8088:8088 hugegraph/hubble` 快速启动 [hubble](https://hub.docker.com/r/hugegraph/hubble). - -或者使用docker-compose启动hubble,另外如果hubble和graph在同一个docker网络下,可以使用graph的contain_name进行访问,而不需要宿主机的ip - -使用`docker-compose up -d`,`docker-compose.yml`如下: - -```yaml -version: '3' -services: - graph_hubble: - image: hugegraph/hugegraph - container_name: graph - ports: - - 18080:8080 - - hubble: - image: hugegraph/hubble - container_name: hubble - ports: - - 8088:8088 -``` - ### 3 平台使用流程 平台的模块使用流程如下: diff --git a/content/cn/docs/quickstart/hugegraph-server.md b/content/cn/docs/quickstart/hugegraph-server.md index 9c818dce5..102740f13 100644 --- a/content/cn/docs/quickstart/hugegraph-server.md +++ b/content/cn/docs/quickstart/hugegraph-server.md @@ -1,6 +1,6 @@ --- title: "HugeGraph-Server Quick Start" -linkTitle: "Install HugeGraph-Server" +linkTitle: "Install/Build HugeGraph-Server" weight: 1 --- @@ -26,35 +26,37 @@ java -version ### 3 部署 -有三种方式可以部署 HugeGraph-Server 组件: +有四种方式可以部署 HugeGraph-Server 组件: -- 方式 1:一键部署 +- 方式 1:使用 Docker 容器 (推荐) - 方式 2:下载 tar 包 - 方式 3:源码编译 -- 方式 4:使用 Docker 容器 +- 方式 4:使用 tools 工具部署 (Outdated) -#### 3.1 一键部署 +#### 3.1 使用 Docker 容器 (推荐) + +可参考 [Docker 部署方式](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-dist/README.md)。 -HugeGraph-Tools 提供了一键部署的命令行工具,用户可以使用该工具快速地一键下载、解压、配置并启动 HugeGraph-Server 和 HugeGraph-Hubble,最新的 HugeGraph-Toolchain 中已经包含所有的这些工具,直接下载它解压就有工具包集合了 +我们可以使用 `docker run -itd --name=graph -p 8080:8080 hugegraph/hugegraph` 去快速启动一个内置了 `RocksDB` 的 `Hugegraph server`. -```bash -# download toolchain package, it includes loader + tool + hubble, please check the latest version (here is 1.0.0) -wget https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-toolchain-incubating-1.0.0.tar.gz -tar zxf *hugegraph-*.tar.gz -# enter the tool's package -cd *hugegraph*/*tool* -``` +可选项: -> 注:`${version}` 为版本号,最新版本号可参考 [Download 页面](/docs/download/download),或直接从 Download 页面点击链接下载 +1. 可以使用 `docker exec -it graph bash` 进入容器完成一些操作 +2. 可以使用 `docker run -itd --name=graph -p 8080:8080 -e PRELOAD="true" hugegraph/hugegraph` 在启动的时候预加载一个 **内置的** 样例图. -HugeGraph-Tools 的总入口脚本是 `bin/hugegraph`,用户可以使用 `help` 子命令查看其用法,这里只介绍一键部署的命令。 +另外, 我们也可以使用 `docker-compose` 完成部署, 使用 `docker-compose up -d`, 以下是一个样例的 `docker-compose.yml`: -```bash -bin/hugegraph deploy -v {hugegraph-version} -p {install-path} [-u {download-path-prefix}] +```yaml +version: '3' +services: + graph: + image: hugegraph/hugegraph + #environment: + # - PRELOAD=true + ports: + - 18080:8080 ``` -`{hugegraph-version}` 表示要部署的 HugeGraphServer 及 HugeGraphStudio 的版本,用户可查看 `conf/version-mapping.yaml` 文件获取版本信息,`{install-path}` 指定 HugeGraphServer 及 HugeGraphStudio 的安装目录,`{download-path-prefix}` 可选,指定 HugeGraphServer 及 HugeGraphStudio tar 包的下载地址,不提供时使用默认下载地址,比如要启动 0.6 版本的 HugeGraph-Server 及 HugeGraphStudio 将上述命令写为 `bin/hugegraph deploy -v 0.6 -p services` 即可。 - #### 3.2 下载 tar 包 ```bash @@ -105,9 +107,28 @@ mvn package -DskipTests 执行成功后,在 hugegraph 目录下生成 hugegraph-*.tar.gz 文件,就是编译生成的 tar 包。 -#### 3.4 使用 Docker 容器 -可参考 [Docker 部署方式](https://hub.docker.com/r/hugegraph/hugegraph)。 +#### 3.4 使用 tools 工具部署 (Outdated) + +HugeGraph-Tools 提供了一键部署的命令行工具,用户可以使用该工具快速地一键下载、解压、配置并启动 HugeGraph-Server 和 HugeGraph-Hubble,最新的 HugeGraph-Toolchain 中已经包含所有的这些工具,直接下载它解压就有工具包集合了 + +```bash +# download toolchain package, it includes loader + tool + hubble, please check the latest version (here is 1.0.0) +wget https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-toolchain-incubating-1.0.0.tar.gz +tar zxf *hugegraph-*.tar.gz +# enter the tool's package +cd *hugegraph*/*tool* +``` + +> 注:`${version}` 为版本号,最新版本号可参考 [Download 页面](/docs/download/download),或直接从 Download 页面点击链接下载 + +HugeGraph-Tools 的总入口脚本是 `bin/hugegraph`,用户可以使用 `help` 子命令查看其用法,这里只介绍一键部署的命令。 + +```bash +bin/hugegraph deploy -v {hugegraph-version} -p {install-path} [-u {download-path-prefix}] +``` + +`{hugegraph-version}` 表示要部署的 HugeGraphServer 及 HugeGraphStudio 的版本,用户可查看 `conf/version-mapping.yaml` 文件获取版本信息,`{install-path}` 指定 HugeGraphServer 及 HugeGraphStudio 的安装目录,`{download-path-prefix}` 可选,指定 HugeGraphServer 及 HugeGraphStudio tar 包的下载地址,不提供时使用默认下载地址,比如要启动 0.6 版本的 HugeGraph-Server 及 HugeGraphStudio 将上述命令写为 `bin/hugegraph deploy -v 0.6 -p services` 即可。 ### 4 配置 @@ -117,6 +138,49 @@ mvn package -DskipTests ### 5 启动 +#### 5.1 使用docker + +在 [3.1 使用 Docker 容器](#31-使用-docker-容器-推荐)中, 我们已经介绍了 如何使用 `docker` 部署 `hugegraph-server`, 我们还可以设置参数在sever启动的时候加载样例图 + +##### 5.1.1 启动server的时候创建示例图 + +在docker启动的时候设置环境变量 `PRELOAD=true`, 从而实现启动脚本的时候加载数据。 + +1. 使用`docker run` + + 使用 `docker run -itd --name=graph -p 18080:8080 -e PRELOAD=true hugegraph/hugegraph:latest` + +2. 使用`docker-compose` + + 创建`docker-compose.yml`,具体文件如下 + + ```yaml + version: '3' + services: + graph: + image: hugegraph/hugegraph:latest + container_name: graph + environment: + - PRELOAD=true + ports: + - 18080:8080 + ``` + + 使用命令 `docker-compose up -d` 启动容器 + +使用 RESTful API 请求 `HugeGraphServer` 得到如下结果: + +```javascript +> curl "http://localhost:18080/graphs/hugegraph/graph/vertices" | gunzip + +{"vertices":[{"id":"2:lop","label":"software","type":"vertex","properties":{"name":"lop","lang":"java","price":328}},{"id":"1:josh","label":"person","type":"vertex","properties":{"name":"josh","age":32,"city":"Beijing"}},{"id":"1:marko","label":"person","type":"vertex","properties":{"name":"marko","age":29,"city":"Beijing"}},{"id":"1:peter","label":"person","type":"vertex","properties":{"name":"peter","age":35,"city":"Shanghai"}},{"id":"1:vadas","label":"person","type":"vertex","properties":{"name":"vadas","age":27,"city":"Hongkong"}},{"id":"2:ripple","label":"software","type":"vertex","properties":{"name":"ripple","lang":"java","price":199}}]} +``` + +代表创建示例图成功。 + + +#### 5.2 使用启动脚本启动 + 启动分为"首次启动"和"非首次启动",这么区分是因为在第一次启动前需要初始化后端数据库,然后启动服务。 而在人为停掉服务后,或者其他原因需要再次启动服务时,因为后端数据库是持久化存在的,直接启动服务即可。 @@ -127,16 +191,29 @@ HugeGraphServer 启动时会连接后端存储并尝试检查后端存储版本 由于各种后端所需的配置(hugegraph.properties)及启动步骤略有不同,下面逐一对各后端的配置及启动做介绍。 -#### 5.1 Memory +##### 5.2.1 RocksDB + +
+点击展开/折叠 RocksDB 配置及启动方法 + + +> RocksDB 是一个嵌入式的数据库,不需要手动安装部署,要求 GCC 版本 >= 4.3.0(GLIBCXX_3.4.10),如不满足,需要提前升级 GCC 修改 `hugegraph.properties` ```properties -backend=memory -serializer=text +backend=rocksdb +serializer=binary +rocksdb.data_path=. +rocksdb.wal_path=. ``` -> Memory 后端的数据是保存在内存中无法持久化的,不需要初始化后端,这也是唯一一个不需要初始化的后端。 +初始化数据库(仅第一次启动时需要) + +```bash +cd hugegraph-${version} +bin/init-store.sh +``` 启动 server @@ -148,17 +225,27 @@ Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK 提示的 url 与 `rest-server.properties` 中配置的 `restserver.url` 一致 -#### 5.2 RocksDB +##### 5.2.2 HBase -> RocksDB 是一个嵌入式的数据库,不需要手动安装部署,要求 GCC 版本 >= 4.3.0(GLIBCXX_3.4.10),如不满足,需要提前升级 GCC +
+点击展开/折叠 HBase 配置及启动方法 + +> 用户需自行安装 HBase,要求版本 2.0 以上,[下载地址](https://hbase.apache.org/downloads.html) 修改 hugegraph.properties ```properties -backend=rocksdb -serializer=binary -rocksdb.data_path=. -rocksdb.wal_path=. +backend=hbase +serializer=hbase + +# hbase backend config +hbase.hosts=localhost +hbase.port=2181 +# Note: recommend to modify the HBase partition number by the actual/env data amount & RS amount before init store +# it may influence the loading speed a lot +#hbase.enable_partition=true +#hbase.vertex_partitions=10 +#hbase.edge_partitions=30 ``` 初始化数据库(仅第一次启动时需要) @@ -176,7 +263,58 @@ Starting HugeGraphServer... Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK ``` -#### 5.3 Cassandra +> 更多其它后端配置可参考[配置项介绍](/docs/config/config-option) + +
+ +##### 5.2.3 MySQL + +
+点击展开/折叠 MySQL 配置及启动方法 + +> 由于 MySQL 是在 GPL 协议下,与 Apache 协议不兼容,用户需自行安装 MySQL,[下载地址](https://dev.mysql.com/downloads/mysql/) + +下载 MySQL 的[驱动包](https://repo1.maven.org/maven2/mysql/mysql-connector-java/),比如 `mysql-connector-java-8.0.30.jar`,并放入 HugeGraph-Server 的 `lib` 目录下。 + +修改 `hugegraph.properties`,配置数据库 URL,用户名和密码,`store` 是数据库名,如果没有会被自动创建。 + +```properties +backend=mysql +serializer=mysql + +store=hugegraph + +# mysql backend config +jdbc.driver=com.mysql.cj.jdbc.Driver +jdbc.url=jdbc:mysql://127.0.0.1:3306 +jdbc.username= +jdbc.password= +jdbc.reconnect_max_times=3 +jdbc.reconnect_interval=3 +jdbc.ssl_mode=false +``` + +初始化数据库(仅第一次启动时需要) + +```bash +cd hugegraph-${version} +bin/init-store.sh +``` + +启动 server + +```bash +bin/start-hugegraph.sh +Starting HugeGraphServer... +Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK +``` + +
+ +##### 5.2.4 Cassandra + +
+点击展开/折叠 Cassandra 配置及启动方法 > 用户需自行安装 Cassandra,要求版本 3.0 以上,[下载地址](http://cassandra.apache.org/download/) @@ -230,7 +368,38 @@ Starting HugeGraphServer... Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK ``` -#### 5.4 ScyllaDB +
+ +##### 5.2.5 Memory + +
+点击展开/折叠 Memory 配置及启动方法 + +修改 hugegraph.properties + +```properties +backend=memory +serializer=text +``` + +> Memory 后端的数据是保存在内存中无法持久化的,不需要初始化后端,这也是唯一一个不需要初始化的后端。 + +启动 server + +```bash +bin/start-hugegraph.sh +Starting HugeGraphServer... +Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK +``` + +提示的 url 与 rest-server.properties 中配置的 restserver.url 一致 + +
+ +##### 5.2.6 ScyllaDB + +
+点击展开/折叠 ScyllaDB 配置及启动方法 > 用户需自行安装 ScyllaDB,推荐版本 2.1 以上,[下载地址](https://docs.scylladb.com/getting-started/) @@ -269,82 +438,33 @@ Starting HugeGraphServer... Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK ``` -#### 5.5 HBase +
-> 用户需自行安装 HBase,要求版本 2.0 以上,[下载地址](https://hbase.apache.org/downloads.html) -修改 hugegraph.properties -```properties -backend=hbase -serializer=hbase -# hbase backend config -hbase.hosts=localhost -hbase.port=2181 -# Note: recommend to modify the HBase partition number by the actual/env data amount & RS amount before init store -# it may influence the loading speed a lot -#hbase.enable_partition=true -#hbase.vertex_partitions=10 -#hbase.edge_partitions=30 -``` -初始化数据库(仅第一次启动时需要) -```bash -cd hugegraph-${version} -bin/init-store.sh -``` +##### 5.2.7 启动server的时候创建示例图 -启动 server +在脚本启动时候携带 `-p true` 参数, 表示preload, 即创建示例图 -```bash -bin/start-hugegraph.sh -Starting HugeGraphServer... -Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK ``` - -> 更多其它后端配置可参考[配置项介绍](/docs/config/config-option) - -#### 5.6 MySQL - -> 由于 MySQL 是在 GPL 协议下,与 Apache 协议不兼容,用户需自行安装 MySQL,[下载地址](https://dev.mysql.com/downloads/mysql/) - -下载 MySQL 的[驱动包](https://repo1.maven.org/maven2/mysql/mysql-connector-java/),比如 `mysql-connector-java-8.0.30.jar`,并放入 HugeGraph-Server 的 `lib` 目录下。 - -修改 `hugegraph.properties`,配置数据库 URL,用户名和密码,`store` 是数据库名,如果没有会被自动创建。 - -```properties -backend=mysql -serializer=mysql - -store=hugegraph - -# mysql backend config -jdbc.driver=com.mysql.cj.jdbc.Driver -jdbc.url=jdbc:mysql://127.0.0.1:3306 -jdbc.username= -jdbc.password= -jdbc.reconnect_max_times=3 -jdbc.reconnect_interval=3 -jdbc.ssl_mode=false +bin/start-hugegraph.sh -p true +Starting HugeGraphServer in daemon mode... +Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)......OK ``` -初始化数据库(仅第一次启动时需要) - -```bash -cd hugegraph-${version} -bin/init-store.sh -``` +并且使用 RESTful API 请求 `HugeGraphServer` 得到如下结果: -启动 server +```javascript +> curl "http://localhost:8080/graphs/hugegraph/graph/vertices" | gunzip -```bash -bin/start-hugegraph.sh -Starting HugeGraphServer... -Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK +{"vertices":[{"id":"2:lop","label":"software","type":"vertex","properties":{"name":"lop","lang":"java","price":328}},{"id":"1:josh","label":"person","type":"vertex","properties":{"name":"josh","age":32,"city":"Beijing"}},{"id":"1:marko","label":"person","type":"vertex","properties":{"name":"marko","age":29,"city":"Beijing"}},{"id":"1:peter","label":"person","type":"vertex","properties":{"name":"peter","age":35,"city":"Shanghai"}},{"id":"1:vadas","label":"person","type":"vertex","properties":{"name":"vadas","age":27,"city":"Hongkong"}},{"id":"2:ripple","label":"software","type":"vertex","properties":{"name":"ripple","lang":"java","price":199}}]} ``` +代表创建示例图成功。 + ### 6 访问 Server #### 6.1 服务启动状态校验 @@ -462,125 +582,4 @@ $bin/stop-hugegraph.sh ### 8 使用 IntelliJ IDEA 调试 Server 请参考[在 IDEA 中配置 Server 开发环境](/docs/contribution-guidelines/hugegraph-server-idea-setup) - -### 9 在启动 Server 时创建示例图 - -有三种方式可以在启动 Server 时创建示例图 -- 方式一:直接修改配置文件 -- 方式二:启动脚本使用命令行参数 -- 方式三:使用 docker 或 docker-compose 添加环境变量 - -#### 9.1 直接修改配置文件 - -修改 `conf/gremlin-server.yaml`,将 `empty-sample.groovy` 修改为 `example.groovy`: - -```yaml -org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { - files: [scripts/example.groovy] -} -``` - -修改 `scripts/example.groovy`,将: - -```groovy -RegisterUtil.registerRocksDB() -conf = "conf/graphs/hugegraph.properties" -graph = HugeFactory.open(conf) -graph.serverStarted(IdGenerator.of("server-tinkerpop"), NodeRole.MASTER) -schema = graph.schema() -``` - -修改为: - -```groovy -conf = "conf/graphs/hugegraph.properties" -graph = HugeFactory.open(conf) -schema = graph.schema() -``` - -然后使用脚本启动 HugeGraph-Server,如果打印出类似日志: - -```java -2023-06-10 19:41:14 [main] [INFO] o.a.h.d.HugeGremlinServer [org.apache.hugegraph.dist.HugeGremlinServer.start(HugeGremlinServer.java:38)] - 3.5.1 - \,,,/ - (o o) ------oOOo-(3)-oOOo----- - -2023-06-10 19:41:14 [main] [INFO] o.a.h.u.ConfigUtil [org.apache.hugegraph.util.ConfigUtil.scanGraphsDir(ConfigUtil.java:88)] - Scanning option 'graphs' directory './conf/graphs' -2023-06-10 19:41:14 [main] [INFO] o.a.h.d.HugeGremlinServer [org.apache.hugegraph.dist.HugeGremlinServer.start(HugeGremlinServer.java:52)] - Configuring Gremlin Server from /Users/dingyuchen/Desktop/hugegraph/apache-hugegraph-incubating-1.0.0/conf/gremlin-server.yaml ->>>> query all vertices: size=6 ->>>> query all edges: size=6 -``` - -并且使用 RESTful API 请求 `HugeGraphServer` 得到如下结果: - -```javascript -> curl "http://localhost:8080/graphs/hugegraph/graph/vertices" | gunzip - - % Total % Received % Xferd Average Speed Time Time Time Current - Dload Upload Total Spent Left Speed -100 222 100 222 0 0 3163 0 --:--:-- --:--:-- --:--:-- 3964 -{"vertices":[{"id":"2:lop","label":"software","type":"vertex","properties":{"name":"lop","lang":"java","price":328}},{"id":"1:josh","label":"person","type":"vertex","properties":{"name":"josh","age":32,"city":"Beijing"}},{"id":"1:marko","label":"person","type":"vertex","properties":{"name":"marko","age":29,"city":"Beijing"}},{"id":"1:peter","label":"person","type":"vertex","properties":{"name":"peter","age":35,"city":"Shanghai"}},{"id":"1:vadas","label":"person","type":"vertex","properties":{"name":"vadas","age":27,"city":"Hongkong"}},{"id":"2:ripple","label":"software","type":"vertex","properties":{"name":"ripple","lang":"java","price":199}}]} -``` - -代表创建示例图成功。 - -> 使用 IntelliJ IDEA 在启动 Server 时创建示例图的流程类似,不再赘述。 - - -#### 9.2 启动脚本时指定参数 - -在脚本启动时候携带 `-p true`参数,表示 preload, 即创建示例图图 - -``` -bin/start-hugegraph.sh -p true -Starting HugeGraphServer in daemon mode... -Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)......OK -``` - -并且使用 RESTful API 请求 `HugeGraphServer` 得到如下结果: - -```javascript -> curl "http://localhost:8080/graphs/hugegraph/graph/vertices" | gunzip - -{"vertices":[{"id":"2:lop","label":"software","type":"vertex","properties":{"name":"lop","lang":"java","price":328}},{"id":"1:josh","label":"person","type":"vertex","properties":{"name":"josh","age":32,"city":"Beijing"}},{"id":"1:marko","label":"person","type":"vertex","properties":{"name":"marko","age":29,"city":"Beijing"}},{"id":"1:peter","label":"person","type":"vertex","properties":{"name":"peter","age":35,"city":"Shanghai"}},{"id":"1:vadas","label":"person","type":"vertex","properties":{"name":"vadas","age":27,"city":"Hongkong"}},{"id":"2:ripple","label":"software","type":"vertex","properties":{"name":"ripple","lang":"java","price":199}}]} -``` - -代表创建示例图成功。 - - -#### 9.3 使用 docker 启动 - -在 docker 启动的时候设置环境变量 `PRELOAD=true`, 从而实现启动脚本的时候加载数据。 - -1. 使用`docker run` - - 使用 `docker run -itd --name=graph -p 18080:8080 -e PRELOAD=true hugegraph/hugegraph:latest` - -2. 使用`docker-compose` - - 创建`docker-compose.yml`,具体文件如下 - - ```yaml - version: '3' - services: - graph: - image: hugegraph/hugegraph:latest - container_name: graph - environment: - - PRELOAD=true - ports: - - 18080:8080 - ``` - - 使用命令 `docker-compose up -d` 启动容器 - -使用 RESTful API 请求 `HugeGraphServer` 得到如下结果: - -```javascript -> curl "http://localhost:18080/graphs/hugegraph/graph/vertices" | gunzip - -{"vertices":[{"id":"2:lop","label":"software","type":"vertex","properties":{"name":"lop","lang":"java","price":328}},{"id":"1:josh","label":"person","type":"vertex","properties":{"name":"josh","age":32,"city":"Beijing"}},{"id":"1:marko","label":"person","type":"vertex","properties":{"name":"marko","age":29,"city":"Beijing"}},{"id":"1:peter","label":"person","type":"vertex","properties":{"name":"peter","age":35,"city":"Shanghai"}},{"id":"1:vadas","label":"person","type":"vertex","properties":{"name":"vadas","age":27,"city":"Hongkong"}},{"id":"2:ripple","label":"software","type":"vertex","properties":{"name":"ripple","lang":"java","price":199}}]} -``` - -代表创建示例图成功。 + \ No newline at end of file diff --git a/content/cn/docs/quickstart/hugegraph-tools.md b/content/cn/docs/quickstart/hugegraph-tools.md index cab1be42e..da8c640c2 100644 --- a/content/cn/docs/quickstart/hugegraph-tools.md +++ b/content/cn/docs/quickstart/hugegraph-tools.md @@ -1,7 +1,7 @@ --- title: "HugeGraph-Tools Quick Start" linkTitle: "Manage with HugeGraph-Tools" -weight: 3 +weight: 5 --- ### 1 HugeGraph-Tools概述 diff --git a/content/en/docs/SUMMARY.md b/content/en/docs/SUMMARY.md index ecb669c00..0508250a8 100644 --- a/content/en/docs/SUMMARY.md +++ b/content/en/docs/SUMMARY.md @@ -5,11 +5,11 @@ ## Quickstart * [Install HugeGraph-Server](quickstart/hugegraph-server.md) * [Load data with HugeGraph-Loader](quickstart/hugegraph-loader.md) -* [Manage with HugeGraph-Tools](quickstart/hugegraph-tools.md) * [Visual with HugeGraph-Hubble](quickstart/hugegraph-hubble.md) -* [Display with HugeGraph-Studio](quickstart/hugegraph-studio.md) * [Develop with HugeGraph-Client](quickstart/hugegraph-client.md) +* [Manage with HugeGraph-Tools](quickstart/hugegraph-tools.md) * [Analysis with HugeGraph-Computer](quickstart/hugegraph-computer.md) +* [Display with HugeGraph-Studio](quickstart/hugegraph-studio.md) ## Config * [Config Guide](config/config-guide.md) diff --git a/content/en/docs/quickstart/hugegraph-client.md b/content/en/docs/quickstart/hugegraph-client.md index 602b0c901..d321c93ad 100644 --- a/content/en/docs/quickstart/hugegraph-client.md +++ b/content/en/docs/quickstart/hugegraph-client.md @@ -1,7 +1,7 @@ --- title: "HugeGraph-Client Quick Start" linkTitle: "Develop with HugeGraph-Client" -weight: 6 +weight: 4 --- ### 1 Overview Of Hugegraph diff --git a/content/en/docs/quickstart/hugegraph-computer.md b/content/en/docs/quickstart/hugegraph-computer.md index 5518b2e3e..cce97d6a1 100644 --- a/content/en/docs/quickstart/hugegraph-computer.md +++ b/content/en/docs/quickstart/hugegraph-computer.md @@ -1,7 +1,7 @@ --- title: "HugeGraph-Computer Quick Start" linkTitle: "Analysis with HugeGraph-Computer" -weight: 7 +weight: 6 --- ## 1 HugeGraph-Computer Overview diff --git a/content/en/docs/quickstart/hugegraph-hubble.md b/content/en/docs/quickstart/hugegraph-hubble.md index 1b086f75c..aab840bad 100644 --- a/content/en/docs/quickstart/hugegraph-hubble.md +++ b/content/en/docs/quickstart/hugegraph-hubble.md @@ -1,7 +1,7 @@ --- title: "HugeGraph-Hubble Quick Start" linkTitle: "Visual with HugeGraph-Hubble" -weight: 4 +weight: 3 --- ### 1 HugeGraph-Hubble Overview @@ -35,11 +35,38 @@ For Gremlin tasks that need to traverse the whole graph, index creation and reco ### 2 Deploy There are three ways to deplot `hugegraph-hubble` +- Use Docker (recommended) - Download the Toolchain binary package - Source code compilation -- Use Docker -#### 2.1 Download the Toolchain binary package +#### 2.1 Use docker (recommended) + +> **Special Note**: If you are starting `hubble` with Docker, and `hubble` and the server are on the same host. When configuring the hostname for the graph on the Hubble web page, please do not directly set it to `localhost/127.0.0.1`. This will refer to the `hubble` container internally rather than the host machine, resulting in a connection failure to the server. + +We can use `docker run -itd --name=hubble -p 8088:8088 hugegraph/hubble` to quick start [hubble](https://hub.docker.com/r/hugegraph/hubble). + +Alternatively, you can use Docker Compose to start `hubble`. Additionally, if `hubble` and the graph are in the same Docker network, you can access the graph using the container name of the graph, eliminating the need for the host machine's IP address. + +Use `docker-compose up -d`,`docker-compose.yml` is following: + +```yaml +version: '3' +services: + server: + image: hugegraph/hugegraph + container_name: graph + ports: + - 18080:8080 + + hubble: + image: hugegraph/hubble + container_name: hubble + ports: + - 8088:8088 +``` + + +#### 2.2 Download the Toolchain binary package `hubble` is in the `toolchain` project. First, download the binary tar tarball @@ -68,7 +95,7 @@ starting HugeGraphHubble ..............timed out with http status 502 Then use a web browser to access `ip:8088` and you can see the `Hubble` page. You can stop the service using bin/stop-hubble.sh. -#### 2.2 Source code compilation +#### 2.3 Source code compilation **Note**: Compiling Hubble requires the user's local environment to have Node.js V16.x and yarn installed. @@ -114,33 +141,6 @@ Run `hubble` bin/start-hubble.sh -d ``` -#### 2.3 Use docker - -> **Special Note**: If you are starting `hubble` with Docker, and `hubble` and the server are on the same host. When configuring the hostname for the graph on the Hubble web page, please do not directly set it to `localhost/127.0.0.1`. This will refer to the `hubble` container internally rather than the host machine, resulting in a connection failure to the server. - -We can use `docker run -itd --name=hubble -p 8088:8088 hugegraph/hubble` to quick start [hubble](https://hub.docker.com/r/hugegraph/hubble). - -Alternatively, you can use Docker Compose to start `hubble`. Additionally, if `hubble` and the graph are in the same Docker network, you can access the graph using the container name of the graph, eliminating the need for the host machine's IP address. - -Use `docker-compose up -d`,`docker-compose.yml` is following: - -```yaml -version: '3' -services: - graph_hubble: - image: hugegraph/hugegraph - container_name: graph - ports: - - 18080:8080 - - hubble: - image: hugegraph/hubble - container_name: hubble - ports: - - 8088:8088 -``` - - ### 3 Platform Workflow The module usage process of the platform is as follows: diff --git a/content/en/docs/quickstart/hugegraph-server.md b/content/en/docs/quickstart/hugegraph-server.md index a34566812..dcff9aa7c 100644 --- a/content/en/docs/quickstart/hugegraph-server.md +++ b/content/en/docs/quickstart/hugegraph-server.md @@ -22,39 +22,36 @@ Consider use Java 11 to run `HugeGraph-Server` (also compatible with Java 8 now) ### 3 Deploy -There are three ways to deploy HugeGraph-Server components: +There are four ways to deploy HugeGraph-Server components: -- Method 1: One-click deployment -- Method 2: Download the binary tarball (most recommended) +- Method 1: Use Docker container (recommended) +- Method 2: Download the binary tarball - Method 3: Source code compilation -- Method 4: Use Docker container +- Method 4: One-click deployment -#### 3.1 One-click deployment +#### 3.1 Use Docker container (recommended) + +You can refer to [Docker deployment guide](https://hub.docker.com/r/hugegraph/hugegraph). -`HugeGraph-Tools` provides a command-line tool for one-click deployment, users can use this tool to quickly download, decompress, configure and start `HugeGraphServer` and `HugeGraph-Hubble` with one click. +We can use `docker run -itd --name=graph -p 8080:8080 hugegraph/hugegraph` to quickly start an inner `HugeGraph server` with `RocksDB` in background. -Of course, you should download the tarball of `HugeGraph-Toolchain` first. +Optional: +1. use `docker exec -it graph bash` to enter the container to do some operations. +2. use `docker run -itd --name=graph -p 8080:8080 -e PRELOAD="true" hugegraph/hugegraph` to start with a **built-in** example graph. -```bash -# download toolchain binary package, it includes loader + tool + hubble -# please check the latest version (e.g. here is 1.0.0) -wget https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-toolchain-incubating-1.0.0.tar.gz -tar zxf *hugegraph-*.tar.gz - -# enter the tool's package -cd *hugegraph*/*tool* -``` +Also, we can use `docker-compose` to deploy, with `docker-compose up -d`. Here is an example `docker-compose.yml`: -> note: `${version}` is the version, The latest version can refer to [Download Page](/docs/download/download), or click the link to download directly from the Download page - -The general entry script for HugeGraph-Tools is `bin/hugegraph`, Users can use the `help` command to view its usage, here only the commands for one-click deployment are introduced. - -```bash -bin/hugegraph deploy -v {hugegraph-version} -p {install-path} [-u {download-path-prefix}] +```yaml +version: '3' +services: + graph: + image: hugegraph/hugegraph + #environment: + # - PRELOAD=true + ports: + - 18080:8080 ``` -`{hugegraph-version}` indicates the version of HugeGraphServer and HugeGraphStudio to be deployed, users can view the `conf/version-mapping.yaml` file for version information, `{install-path}` specify the installation directory of HugeGraphServer and HugeGraphStudio, `{download-path-prefix}` optional, specify the download address of HugeGraphServer and HugeGraphStudio tarball, use default download URL if not provided, for example, to start HugeGraph-Server and HugeGraphStudio version 0.6, write the above command as `bin/hugegraph deploy -v 0.6 -p services`. - #### 3.2 Download the binary tar tarball You could download the binary tarball from the download page of ASF site like this: @@ -120,9 +117,31 @@ The execution log is as follows: After successful execution, `*hugegraph-*.tar.gz` files will be generated in the hugegraph directory, which is the tarball generated by compilation. -#### 3.4 Use Docker container +#### 3.4 One-click deployment -You can refer to [Docker deployment guide](https://hub.docker.com/r/hugegraph/hugegraph). +`HugeGraph-Tools` provides a command-line tool for one-click deployment, users can use this tool to quickly download, decompress, configure and start `HugeGraphServer` and `HugeGraph-Hubble` with one click. + +Of course, you should download the tarball of `HugeGraph-Toolchain` first. + +```bash +# download toolchain binary package, it includes loader + tool + hubble +# please check the latest version (e.g. here is 1.0.0) +wget https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-toolchain-incubating-1.0.0.tar.gz +tar zxf *hugegraph-*.tar.gz + +# enter the tool's package +cd *hugegraph*/*tool* +``` + +> note: `${version}` is the version, The latest version can refer to [Download Page](/docs/download/download), or click the link to download directly from the Download page + +The general entry script for HugeGraph-Tools is `bin/hugegraph`, Users can use the `help` command to view its usage, here only the commands for one-click deployment are introduced. + +```bash +bin/hugegraph deploy -v {hugegraph-version} -p {install-path} [-u {download-path-prefix}] +``` + +`{hugegraph-version}` indicates the version of HugeGraphServer and HugeGraphStudio to be deployed, users can view the `conf/version-mapping.yaml` file for version information, `{install-path}` specify the installation directory of HugeGraphServer and HugeGraphStudio, `{download-path-prefix}` optional, specify the download address of HugeGraphServer and HugeGraphStudio tarball, use default download URL if not provided, for example, to start HugeGraph-Server and HugeGraphStudio version 0.6, write the above command as `bin/hugegraph deploy -v 0.6 -p services`. ### 4 Config @@ -131,6 +150,48 @@ for detailed configuration introduction, please refer to [configuration document ### 5 Startup +#### 5.1 Use docker to startup + +In [3.1 Use Docker container](#31-use-docker-container-recommended), we have introduced how to use docker to deploy `hugegraph-server`. `server` can also preload an example graph by setting the parameter. + +##### 5.1.1 Create example graph when starting server + +Set the environment variable `PRELOAD=true` when starting Docker in order to load data during the execution of the startup script. + +1. Use `docker run` + + Use `docker run -itd --name=graph -p 18080:8080 -e PRELOAD=true hugegraph/hugegraph:latest` + +2. Use `docker-compose` + + Create `docker-compose.yml` as following + + ```yaml + version: '3' + services: + graph: + image: hugegraph/hugegraph:latest + container_name: graph + environment: + - PRELOAD=true + ports: + - 18080:8080 + ``` + + Use `docker-compose up -d` to start the container + +And use the RESTful API to request `HugeGraphServer` and get the following result: + +```javascript +> curl "http://localhost:8080/graphs/hugegraph/graph/vertices" | gunzip + +{"vertices":[{"id":"2:lop","label":"software","type":"vertex","properties":{"name":"lop","lang":"java","price":328}},{"id":"1:josh","label":"person","type":"vertex","properties":{"name":"josh","age":32,"city":"Beijing"}},{"id":"1:marko","label":"person","type":"vertex","properties":{"name":"marko","age":29,"city":"Beijing"}},{"id":"1:peter","label":"person","type":"vertex","properties":{"name":"peter","age":35,"city":"Shanghai"}},{"id":"1:vadas","label":"person","type":"vertex","properties":{"name":"vadas","age":27,"city":"Hongkong"}},{"id":"2:ripple","label":"software","type":"vertex","properties":{"name":"ripple","lang":"java","price":199}}]} +``` + +This indicates the successful creation of the sample graph. + +#### 5.2 Use a startup script to startup + The startup is divided into "first startup" and "non-first startup". This distinction is because the back-end database needs to be initialized before the first startup, and then the service is started. after the service is stopped artificially, or when the service needs to be started again for other reasons, because the backend database is persistent, you can start the service directly. @@ -141,7 +202,10 @@ If you need to access HugeGraphServer externally, please modify the `restserver. Since the configuration (hugegraph.properties) and startup steps required by various backends are slightly different, the following will introduce the configuration and startup of each backend one by one. -#### 5.1 Memory +##### 5.2.1 Memory + +
+Click to expand/collapse Memory configuration and startup methods Update hugegraph.properties @@ -162,7 +226,12 @@ Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK The prompted url is the same as the restserver.url configured in rest-server.properties -#### 5.2 RocksDB +
+ +##### 5.2.2 RocksDB + +
+Click to expand/collapse RocksDB configuration and startup methods > RocksDB is an embedded database that does not require manual installation and deployment. GCC version >= 4.3.0 (GLIBCXX_3.4.10) is required. If not, GCC needs to be upgraded in advance @@ -190,7 +259,12 @@ Starting HugeGraphServer... Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK ``` -#### 5.3 Cassandra +
+ +##### 5.2.3 Cassandra + +
+Click to expand/collapse Cassandra configuration and startup methods > users need to install Cassandra by themselves, requiring version 3.0 or above, [download link](http://cassandra.apache.org/download/) @@ -245,7 +319,12 @@ Starting HugeGraphServer... Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK ``` -#### 5.4 ScyllaDB +
+ +##### 5.2.4 ScyllaDB + +
+Click to expand/collapse ScyllaDB configuration and startup methods > users need to install ScyllaDB by themselves, version 2.1 or above is recommended, [download link](https://docs.scylladb.com/getting-started/) @@ -284,7 +363,12 @@ Starting HugeGraphServer... Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK ``` -#### 5.5 HBase +
+ +##### 5.2.5 HBase + +
+Click to expand/collapse HBase configuration and startup methods > users need to install HBase by themselves, requiring version 2.0 or above,[download link](https://hbase.apache.org/downloads.html) @@ -321,7 +405,12 @@ Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK > for more other backend configurations, please refer to[introduction to configuration options](/docs/config/config-option) -#### 5.6 MySQL +
+ +##### 5.2.6 MySQL + +
+Click to expand/collapse MySQL configuration and startup methods > Due to MySQL is under GPL license, which is not compatible with Apache License indeed, Users need to install MySQL, [Download Link](https://dev.mysql.com/downloads/mysql/) @@ -360,6 +449,28 @@ Starting HugeGraphServer... Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK ``` +
+ +##### 5.2.7 Create an example graph when startup + +Carry the `-p true` arguments when starting the script, which indicates `preload`, to create a sample graph. + +``` +bin/start-hugegraph.sh -p true +Starting HugeGraphServer in daemon mode... +Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)......OK +``` + +And use the RESTful API to request `HugeGraphServer` and get the following result: + +```javascript +> curl "http://localhost:8080/graphs/hugegraph/graph/vertices" | gunzip + +{"vertices":[{"id":"2:lop","label":"software","type":"vertex","properties":{"name":"lop","lang":"java","price":328}},{"id":"1:josh","label":"person","type":"vertex","properties":{"name":"josh","age":32,"city":"Beijing"}},{"id":"1:marko","label":"person","type":"vertex","properties":{"name":"marko","age":29,"city":"Beijing"}},{"id":"1:peter","label":"person","type":"vertex","properties":{"name":"peter","age":35,"city":"Shanghai"}},{"id":"1:vadas","label":"person","type":"vertex","properties":{"name":"vadas","age":27,"city":"Hongkong"}},{"id":"2:ripple","label":"software","type":"vertex","properties":{"name":"ripple","lang":"java","price":199}}]} +``` + +This indicates the successful creation of the sample graph. + ### 6 Access server #### 6.1 Service startup status check @@ -477,115 +588,3 @@ $bin/stop-hugegraph.sh ### 8 Debug Server with IntelliJ IDEA Please refer to [Setup Server in IDEA](/docs/contribution-guidelines/hugegraph-server-idea-setup) - -### 9 Create Sample Graph on Server Startup - -There are three ways to create sample graph on server startup -- Method 1: Modify the configuration file directly. -- Method 2: Use command-line arguments in the startup script. -- Method 3: Use Docker or Docker Compose to add environment variables. - -#### 9.1 Modify the configuration file directly. - -Modify `conf/gremlin-server.yaml` and change `empty-sample.groovy` to `example.groovy`: - -```yaml -org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { - files: [scripts/example.groovy] -} -``` - -Modify `scripts/example.groovy` as follows: - -```groovy -conf = "conf/graphs/hugegraph.properties" -graph = HugeFactory.open(conf) -schema = graph.schema() -``` - -Afterwards, start the HugeGraph-Server using the script. If logs similar to the following are printed: - -```java -2023-06-10 19:41:14 [main] [INFO] o.a.h.d.HugeGremlinServer [org.apache.hugegraph.dist.HugeGremlinServer.start(HugeGremlinServer.java:38)] - 3.5.1 - \,,,/ - (o o) ------oOOo-(3)-oOOo----- - -2023-06-10 19:41:14 [main] [INFO] o.a.h.u.ConfigUtil [org.apache.hugegraph.util.ConfigUtil.scanGraphsDir(ConfigUtil.java:88)] - Scanning option 'graphs' directory './conf/graphs' -2023-06-10 19:41:14 [main] [INFO] o.a.h.d.HugeGremlinServer [org.apache.hugegraph.dist.HugeGremlinServer.start(HugeGremlinServer.java:52)] - Configuring Gremlin Server from /Users/dingyuchen/Desktop/hugegraph/apache-hugegraph-incubating-1.0.0/conf/gremlin-server.yaml ->>>> query all vertices: size=6 ->>>> query all edges: size=6 -``` - -And when using the RESTful API to request `HugeGraphServer`, you receive the following result: - -```javascript -> curl "http://localhost:8080/graphs/hugegraph/graph/vertices" | gunzip - - % Total % Received % Xferd Average Speed Time Time Time Current - Dload Upload Total Spent Left Speed -100 222 100 222 0 0 3163 0 --:--:-- --:--:-- --:--:-- 3964 -{"vertices":[{"id":"2:lop","label":"software","type":"vertex","properties":{"name":"lop","lang":"java","price":328}},{"id":"1:josh","label":"person","type":"vertex","properties":{"name":"josh","age":32,"city":"Beijing"}},{"id":"1:marko","label":"person","type":"vertex","properties":{"name":"marko","age":29,"city":"Beijing"}},{"id":"1:peter","label":"person","type":"vertex","properties":{"name":"peter","age":35,"city":"Shanghai"}},{"id":"1:vadas","label":"person","type":"vertex","properties":{"name":"vadas","age":27,"city":"Hongkong"}},{"id":"2:ripple","label":"software","type":"vertex","properties":{"name":"ripple","lang":"java","price":199}}]} -``` - -indicating the successful creation of the sample graph. - -> The process of creating sample graph on server startup is similar when using IntelliJ IDEA and will not be described further. - - -#### 9.2 Specify command-line arguments in the startup script. - -Carry the `-p true` arguments when starting the script, which indicates `preload`, to create a sample graph. - -``` -bin/start-hugegraph.sh -p true -Starting HugeGraphServer in daemon mode... -Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)......OK -``` - -And use the RESTful API to request `HugeGraphServer` and get the following result: - -```javascript -> curl "http://localhost:8080/graphs/hugegraph/graph/vertices" | gunzip - -{"vertices":[{"id":"2:lop","label":"software","type":"vertex","properties":{"name":"lop","lang":"java","price":328}},{"id":"1:josh","label":"person","type":"vertex","properties":{"name":"josh","age":32,"city":"Beijing"}},{"id":"1:marko","label":"person","type":"vertex","properties":{"name":"marko","age":29,"city":"Beijing"}},{"id":"1:peter","label":"person","type":"vertex","properties":{"name":"peter","age":35,"city":"Shanghai"}},{"id":"1:vadas","label":"person","type":"vertex","properties":{"name":"vadas","age":27,"city":"Hongkong"}},{"id":"2:ripple","label":"software","type":"vertex","properties":{"name":"ripple","lang":"java","price":199}}]} -``` - -This indicates the successful creation of the sample graph. - - -#### 9.3 Use Docker or Docker Compose to add environment variables. - -Set the environment variable `PRELOAD=true` when starting Docker in order to load data during the execution of the startup script. - -1. Use `docker run` - - Use `docker run -itd --name=graph -p 18080:8080 -e PRELOAD=true hugegraph/hugegraph:latest` - -2. Use `docker-compose` - - Create `docker-compose.yml` as following - - ```yaml - version: '3' - services: - graph: - image: hugegraph/hugegraph:latest - container_name: graph - environment: - - PRELOAD=true - ports: - - 18080:8080 - ``` - - Use `docker-compose up -d` to start the container - -And use the RESTful API to request `HugeGraphServer` and get the following result: - -```javascript -> curl "http://localhost:8080/graphs/hugegraph/graph/vertices" | gunzip - -{"vertices":[{"id":"2:lop","label":"software","type":"vertex","properties":{"name":"lop","lang":"java","price":328}},{"id":"1:josh","label":"person","type":"vertex","properties":{"name":"josh","age":32,"city":"Beijing"}},{"id":"1:marko","label":"person","type":"vertex","properties":{"name":"marko","age":29,"city":"Beijing"}},{"id":"1:peter","label":"person","type":"vertex","properties":{"name":"peter","age":35,"city":"Shanghai"}},{"id":"1:vadas","label":"person","type":"vertex","properties":{"name":"vadas","age":27,"city":"Hongkong"}},{"id":"2:ripple","label":"software","type":"vertex","properties":{"name":"ripple","lang":"java","price":199}}]} -``` - -This indicates the successful creation of the sample graph. diff --git a/content/en/docs/quickstart/hugegraph-tools.md b/content/en/docs/quickstart/hugegraph-tools.md index 05f566b5b..4221169a5 100644 --- a/content/en/docs/quickstart/hugegraph-tools.md +++ b/content/en/docs/quickstart/hugegraph-tools.md @@ -1,7 +1,7 @@ --- title: "HugeGraph-Tools Quick Start" linkTitle: "Manage with HugeGraph-Tools" -weight: 3 +weight: 5 --- ### 1 HugeGraph-Tools Overview