简体   繁体   English

如何在Postgres后端使用Cayley?

[英]How to use Cayley with a Postgres backend?

As per this Github issue , the Postgres backend feature for the Cayley graph database is implemented. 根据这个Github问题 ,实现了Cayley图数据库的Postgres后端功能。 However, currently there aren't examples in the docs , and I couldn't figure it out by reading the code. 但是,目前文档中没有示例,我无法通过阅读代码来弄明白。 Could someone help? 有人可以帮忙吗?

Edit 编辑

To start playing with Cayley, we can load data that comes with the source with the following command: 要开始使用Cayley,我们可以使用以下命令加载源附带的数据:

./cayley load --config=cayley.cfg.overview --quads=data/30kmoviedata.nq.gz

I tried two variations of the cayley.cfg.overview file: 我尝试了cayley.cfg.overview文件的两个变体:

{
    "database": "sql",
    "db_path": "localhost:5432",
    "read_only": false
}

and

{
    "database": "sql",
    "db_path": "/var/lib/postgresql/9.4/main/cayley",
    "read_only": false
}

The first one being analogous to the one used with mongo (5432 being the port at which the postgres server is listening). 第一个类似于与mongo一起使用的那个(5432是postgres服务器正在监听的端口)。 As for the second one, I have no clue of what I'm doing there :D. 至于第二个,我不知道我在那里做什么:D。

In any case, when I use the ./cayley load --config=cayley.cfg.overview --quads=data/30kmoviedata.nq.gz command I get the following error (varying only the value of db_path ): 在任何情况下,当我使用./cayley load --config=cayley.cfg.overview --quads=data/30kmoviedata.nq.gz命令时,我收到以下错误(仅改变db_path的值):

Couldn't open database at localhost:5432: 
&errors.errorString{s:"missing \"=\" after \"127.0.0.1:5432\" in connection 
info string\""}
E1117 21:09:18.300033 16689 cayley.go:277] missing "=" after "localhost:5432" 
in connection info string"

It looks like Cayley is using lib/pq under the covers. 看起来Cayley正在使用lib / pq。 lib/pq connection strings look something like this: "user=pqgotest dbname=pqgotest sslmode=verify-full" or "postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full" For full details see the lib/pq documentation at godoc.org . lib / pq连接字符串如下所示: "user=pqgotest dbname=pqgotest sslmode=verify-full""postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full"有关完整详细信息,请参阅lib / poc文档在godoc.org

(You can see where the sql.Open call is made in cayley/graph/sql/quadstore.go connectSQLTables .) (您可以在cayley / graph / sql / quadstore.go connectSQLTables查看sql.Open调用的位置。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM