图数据库 | 语言 | 图引擎 | 后端存储 | 访问方式 | 备注 | |||
---|---|---|---|---|---|---|---|---|
Neo4j | java | Cypher http://www.opencypher.org/ |
定制化 | rest | 社区版节点限制 商业版不限制 |
|||
Hugegraph 百度开源图数据库 |
java | tinkerpop https://tinkerpop.apache.org/ |
Rocksdb facebook开源 Cassandra |
rest | 节点不限制 | |||
RedisGraph 官网 https://oss.redislabs.com/redisgraph/ |
c | openCyper 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 |
|||
采用热内存,图引擎cypher,关系图使用稀疏邻接矩阵,位操作,目前性能最佳的图数据库
图表示模型
adjacent matrix
https://mathworld.wolfram.com/AdjacencyMatrix.html
redis-server --loadmodule /path/to/module/src/redisgraph.so
On Ubuntu Linux, run: apt-get install build-essential cmake m4 automake peg libtool autoconf
cmake
m4
automake
libtool
autoconf
需要编译安装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
编译动态库的时候需要使用
添加-fPIC
启动后的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