hugegraph-使用文档

fansichao 2021-10-23 16:25:17
Categories: > Tags:

文档信息:

HugeGragh0.9.0 环境依赖:

scylladb 和 hbase 都支持容量横向扩展(容量上它们一般不会是瓶颈),scylladb 的定位是低延迟(没有 Java GC 停顿、高效的网络库等),hbase 生态更加完善及稳定性较好。

当前环境

TODO 数据冗余,多服务区,异常重连,数据删除等问题,性能测试
后续测试重点:

HugeGraph 简介

HugeGraph是百度在 2018 年中旬开源的一款图数据库(Graph Database)系统,可以存储海量的顶点(Vertex)和边(Edge)。
实现了 Apache ThinkerPop 3[1]框架,支持 Gremlin 图查询语言。
HugeGraph 支持多用户并行操作,用户可输入 Gremlin 查询语句,并及时得到图查询结果。也可以再用户程序中调用 hugeGraph API 进行图分析或查询。

本系统具备如下特点:

本系统的功能包括但不限于

其他等

HugeGraph 优缺点

缺点:

软件使用

安装部署

HugeGragh 共有如下工具

HugeGragh 框架模块

总结: 部署 HugeGraph 需要 HugeGraph-Server,在网页上操作图需要 HugeGraph-Studio。

需要安装 HugeGraph-Server HugeGraph-Studio HugeGraph-Loader 下载解压即用,详情见HugeGraph 官网

如需安装 Hbase,请参考《Hbase 安装文档》

安装部署命令

1
2
3
4
# 默认CentOS会自带这些包,Docker中的镜像需要自行安装

# 解决问题 line 92: crontab: command not found
yum -y install lsof crontabs

配置文件修改

hugegraph-0.9.2/conf/rest-server.properties ServerIP 地址和端口.配置 0.0.0.0 使其他机器可以访问。

1
2
3
4
5
6
7
8
9
10
11
12
(fenv) [fdm@neo4j hugegraph]$ cat hugegraph-0.9.2/conf/rest-server.properties
# bind url
#restserver.url=http://127.0.0.1:8080
restserver.url=http://0.0.0.0:8080

# graphs list with pair NAME:CONF_PATH
graphs=[hugegraph:conf/hugegraph.properties]

# authentication
#auth.require_authentication=
#auth.admin_token=
#auth.user_tokens=[]

配置数据库-RocksDB

配置数据库-ScyllaDB

参考文档《ScyllaDB》

配置数据库-HBase

参考文档《Hbase 安装文档》

特殊声明:由于安装 Hbase,需要先安装 Hadoop,配置 ResourceManager|DataNode|NodeManager|SecondaryNameNode|NameNode。
其中 ResourceManager 的端口 8080 和 HugeGraph 端口冲突,需要先修改 ResourceManager 端口

1
2
3
4
5
6
7
# vim ./share/doc/hadoop/hadoop-yarn/hadoop-yarn-common/yarn-default.xml
134 <property>
135 <description>The http address of the RM web application.</description>
136 <name>yarn.resourcemanager.webapp.address</name>
137 <value>${yarn.resourcemanager.hostname}:8081</value>
138 </property>
# 修改点,原 8080 修改为 8081。 重启Hadoop服务 stop-all.sh & start-all.sh

配置 HugeGraph 连接数据库

修改配置文件

初始化数据库

bin/init-store.sh

初始化数据库时,必须先 bin/stop-hugegraph.sh ,否则可能初始化失败。

启动服务

bin/start-hugegraph.sh

启动服务时,必须先关闭 hugegraph-studio 服务。否则会启动失败,报错端口已被使用。

HugeGragh 支持多图库模式

TODO (未发现多库查询方法)

参考链接: HugeGraph 配置

常用命令

一键重启脚本

1
2
3
4
5
6
7
8
9
10
11
12
restart_hugegraph(){
hugegraph_pwd="/home/scfan/software/hugegraph"
# 关闭服务
ps anx | grep hugegraph-studio|awk '{print $1}' | xargs kill -9
cd $hugegraph_pwd/hugegraph-0.9.2 && bin/stop-hugegraph.sh

# 启动服务
cd $hugegraph_pwd/hugegraph-studio-0.9.0 && nohup bin/hugegraph-studio.sh &
# Server修改配置后,需要关闭 studio 才可以启动
cd $hugegraph_pwd/hugegraph-0.9.2 && bin/start-hugegraph.sh
}
restart_hugegraph

其他命令

1
2
3
4
5
6
7
8
9

# 数据导入命令
cd /home/scfan/software/hugegraph/hugegraph/hugegraph-loader-0.9.0
time bin/hugegraph-loader -g hugegraph -f example/graph_struct.json -s example/graph_schema.groovy

# 删除整个图库数据
curl -XDELETE "http://192.168.100.162:8080/graphs/hugegraph/clear?confirm_message=I'm+sure+to+delete+all+data"
# 支持任务撤销
PUT http://localhost:8080/graphs/hugegraph/tasks/2?action=cancel

可视化界面 Studio: http://192.168.172.72:8088/
后端端口 Server: http://192.168.172.72:8080/graphs

hugegraph_可视化界面

HugeGraph 数据导入

官方链接: HugeGraph-Loader Quick Start

HugeGraph-Loader 是 HugeGragh 的数据导入组件,能够将多种数据源的数据转化为图的顶点和边并批量导入到图数据库中。

目前支持的数据源包括:

参考资源

图库热度排行榜

hugegraph_DBengine 图库排行榜
hugegraph_DBengine图库排行榜

图库综合对比

hugegraph_图库综合对比