【问题标题】:Bulbs python Connection to a remote TitanDB + Rexster灯泡 python 连接到远程 TitanDB + Rexster
【发布时间】:2014-09-19 08:48:24
【问题描述】:

我正在使用 TitanGraphDB + Cassandra。我按如下方式启动Titan

cd titan-cassandra-0.3.1
bin/titan.sh config/titan-server-rexster.xml config/titan-server-cassandra.properties

我有一个 Rexster shell,可以用来与上面的 Titan + Cassandra 通信。

cd rexster-console-2.3.0
bin/rexster-console.sh

我正在尝试使用 Titan Graph DB 对网络拓扑进行建模。我想从我的 python 程序中对 Titan Graph DB 进行编程。我为此使用python bulbs 包。我创建图表的代码如下。

from bulbs.titan import Graph 
self.g = Graph()

现在我在 IP 地址为 192.168.65.93 的机器上运行了 rexster-console 和 Titan。如果我的 python 应用程序在我使用 self.g = Graph() 的同一台机器上运行。

如果我想从192.168.65.94上的python应用程序连接到在IP为192.168.65.93的机器上运行的Titan AND Rexster怎么办

我该怎么做?我可以传递一些参数(例如配置文件到 Graph())吗?我在哪里可以找到它?

【问题讨论】:

  • 这对你有用吗?

标签: python cassandra titan bulbs rexster


【解决方案1】:

只需在 Bulbs Config 对象中设置 Titan 图 URI:

>>> from bulbs.titan import Graph, Config
>>> config = Config('http://192.168.65.93:8182/graphs/graph')
>>> g = Graph(config)

见灯泡Config...

还有灯泡 Graph(注意 Titan 的 Graph 类是 Rexster 的 Graph 类的子类)...

我鼓励您通读 Bulbs 快速入门和其他文档,因为其中很多问题都得到了解答...

快速入门以bulbs.neo4jserver 为例,但由于无论您使用何种后端服务器,Bulbs API 都是一致的,因此快速入门示例也与 Titan Server 和 Rexster 相关。

要调整适用于 Titan 或 Rexster 的灯泡快速入门,只需更改 Graph 导入自...

>>> from bulbs.neo4jserver import Graph
>>> g = Graph()

...到...

>>> from bulbs.titan import Graph
>>> g = Graph()

...或...

>>> from bulbs.rexster import Graph
>>> g = Graph()

【讨论】:

  • 使用from bulbs.titan import Graphfrom bulbs.rexster import Graph有什么区别?他们是否都使用 Rexster 的 REST API 与 Titan 数据库进行通信?如果是,请您指出其中一种的优势吗?
猜你喜欢
  • 2015-06-17
  • 2014-03-21
  • 2016-12-09
  • 2013-10-22
  • 1970-01-01
  • 2014-06-27
  • 2014-02-16
  • 1970-01-01
  • 2021-06-19
相关资源
最近更新 更多