图数据库比较

图数据库比较

图数据库语言图引擎后端存储访问方式备注
Neo4jjavaCypher
http://www.opencypher.org/
定制化rest社区版节点限制
商业版不限制
Hugegraph
百度开源图数据库
javatinkerpop
https://tinkerpop.apache.org/
Rocksdb facebook开源
Cassandra
rest节点不限制
RedisGraph
官网 https://oss.redislabs.com/redisgraph/
copenCyper
https://juejin.im/post/5aba18b85188255c4c104be2
http://www.opencypher.org/
https://github.com/opencypher/openCypher
热内存Redis client为支持高效的图搜索操作,RedisGraph 底层实现了一种称为 Hexastore 的三元组存储结构
采用稀疏矩阵表示,极大节省了内存https://laowei.wang/article/5d1dce6f4b3b1f3cfe5c4d2d redisGraph简单调研 https://www.jianshu.com/p/abf5583bf7ac

RedisGraph

采用热内存,图引擎cypher,关系图使用稀疏邻接矩阵,位操作,目前性能最佳的图数据库
图表示模型
adjacent matrix
https://mathworld.wolfram.com/AdjacencyMatrix.html

新能测试:

  • 启动命令 redis-server --loadmodule /path/to/module/src/redisgraph.so
    • 4000万点,15亿边 twitter数据集
    • 单机 250G内存 32核机器
      https://redislabs.com/blog/new-redisgraph-1-0-achieves-600x-faster-performance-graph-databases/

编译redisgraph

依赖

On Ubuntu Linux, run: apt-get install build-essential cmake m4 automake peg libtool autoconf

cmake
m4
automake
libtool
autoconf

install peg 失败
  • 需要编译安装https://www.piumarta.com/software/peg/ 选择peg-0.1.18.tar.gz

  • 编译问题
    https://stackoverflow.com/questions/9637551/relocation-r-x86-64-32s-against-rodata-while-compiling-on-64-bit-platform

编译源码

tar -zxvf RedisGraph.tar.gz
cd RedisGraph
cd deps/rax/
vim Makefile
//Add -fPIC to CFLAGS or CXXFLAGS for make-based projects.

export CC=/opt/compiler/gcc-8.2/bin/gcc
export CXX=/opt/compiler/gcc-8.2/bin/g++
make -j8
make
make clean

find .|grep redisgraph.so

编译及安装问题
  • 问题1,编译失败
    …/deps/rax/rax.o: relocation r_x86_64_32 against `.rodata.str1.8’ can not be used when making a shared object; recompile with -fpic

编译动态库的时候需要使用
添加-fPIC

  • 问题2,redis start失败,查到版本低造成的,redis load失败
    https://github.com/RedisGraph/redisgraph-py/issues/24
  • 问题3,使用4.0.20 load仍然失败
    RedisGraph requires redis-server version 5.0.7 and up

启动后的log:
./redis-server --loadmodule /home/work/redis-graph/redisgraph.so

18067:M 27 Aug 2020 19:22:47.064 * Graph deletion will be done asynchronously.
18067:M 27 Aug 2020 19:22:47.064 * Thread pool created, using 8 threads.
18067:M 27 Aug 2020 19:22:47.064 * Maximum number of OpenMP threads set to 8
18067:M 27 Aug 2020 19:22:47.064 * Module ‘graph’ loaded from /home/work/redis-graph/redisgraph.so
18067:M 27 Aug 2020 19:22:47.065 * Ready to accept connections

测试

redis-cli client:
创建对象:
127.0.0.1:6379> GRAPH.QUERY social “CREATE (:person {name: ‘roi’, age: 33, gender: ‘male’, status: ‘married’})”
127.0.0.1:6379> GRAPH.QUERY social “CREATE (p:Person)-[:LIKES]→(t:Technology)”

查询对象:
GRAPH.QUERY social “MATCH(Person) return Person”

参考文档
cypher语法使用 https://neo4j.com/developer/cypher/syntax/
cypher使用 https://www.cnblogs.com/ljhdo/p/5516793.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值