灯泡python连接到远程TitanDB+Rex

2024-09-28 14:52:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我用的是TitanGraphDB+Cassandra。我将按如下方式启动泰坦

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

我有一个雷克斯特外壳,我可以用来与上面的泰坦+卡桑德拉通信。在

^{pr2}$

我正在尝试使用Titan Graph DB建立网络拓扑模型。我想从python程序编程Titan Graph DB。我正在使用python bulbs包那个。我的创建图形的代码如下所示。在

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

现在我在IP地址为192.168.65.93的机器上运行rexster控制台和Titan。在

如果我想连接到在机器上运行的Titan AND Rexster,它的IP是192.168.65.93,来自192.168.65.94上的python应用程序

我该怎么做?是否可以传递一些参数(例如,将配置文件传递给Graph())?我在哪能找到它?在


Tags: 机器configdbbinserver方式cdgraph
1条回答
网友
1楼 · 发布于 2024-09-28 14:52:13

只需在bullsConfig对象中设置Titan graph 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类的一个子类)。。。在

我鼓励你通读灯泡快速入门和其他文档,因为这些问题中的许多都在那里得到了解答。。。在

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

为了适应泰坦或雷克斯特灯泡快速启动,只需更改Graph导入。。。在

^{pr2}$

…到。。。在

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

……或者。。。在

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

相关问题 更多 >