我已经玩了Titan graph server一段时间了 . 我的感觉是,尽管有大量文档,但缺乏从头开始入门教程 .
我的最终目标是在cassandra上运行一个titan并使用StartTheShift/thunderdome进行查询 .
我见过几种启动泰坦的方法:
使用Rexster
从this link,我能够通过以下步骤运行titan服务器:
-
将所有文件从
titan-all-0.3.0/libs
复制到rexster-server-2.3.0/ext/titan
-
编辑
rexster-server-2.3.0/rexster.xml
并添加(a之间):
<graph>
<graph-name>geograph</graph-name>
<graph-type>com.thinkaurelius.titan.tinkerpop.rexster.TitanGraphConfiguration</graph-type>
<graph-read-only>false</graph-read-only>
<graph-location>/Users/vallette/projects/DATA/gdb</graph-location>
<properties>
<storage.backend>local</storage.backend>
<storage.directory>/Users/vallette/projects/DATA/gdb</storage.directory>
<buffer-size>100</buffer-size>
</properties>
<extensions>
<allows>
<allow>tp:gremlin</allow>
</allows>
</extensions>
</graph>
对于berkeleydb或:
<graph>
<graph-name>geograph</graph-name>
<graph-type>com.thinkaurelius.titan.tinkerpop.rexster.TitanGraphConfiguration</graph-type>
<graph-location></graph-location>
<graph-read-only>false</graph-read-only>
<properties>
<storage.backend>cassandra</storage.backend>
<storage.hostname>77.77.77.77</storage.hostname>
</properties>
<extensions>
<allows>
<allow>tp:gremlin</allow>
</allows>
</extensions>
</graph>
对于cassandra db .
-
用
./bin/rexster.sh -s -c rexster.xml
启动服务器 -
下载rexster控制台并使用
bin/rexster-console.sh
运行它 -
您现在可以使用
g = rexster.getGraph("geograph")
连接到图表
这种方法的问题是你通过rexster而不是gremlin连接,所以你没有自动完成 . 优点是您可以命名您的数据库(此处为地理位置) .
使用带有cassandra的Titan服务器
-
用
./bin/titan.sh config/titan-server-rexster.xml config/titan-server-cassandra.properties
启动服务器 -
创建一个名为
cassandra.local
的文件
storage.backend=cassandrathrift
storage.hostname=127.0.0.1
- 启动titan gremlin并与
g = TitanFactory.open("cassandra-es.local")
连接
这很好用 .
将Titan服务器与BerkeleyDB一起使用
来自this link:
-
用
./bin/titan.sh config/titan-server-rexster.xml config/titan-server-berkeleydb.properties
启动服务器 -
推出泰坦gremlin:
./bin/gremlin.sh
-
但是一旦我尝试使用
g = TitanFactory.open('graph')
连接到gremlin中的数据库(图形),它就会在我所在的目录中创建一个名为graph的新数据库 . 如果我执行此目录,我的目录(已填充)是:
无法实例化实现:com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager
有人可以澄清这些过程,并告诉我我做错了什么 . 谢谢
3 回答
根据文档
TitanFactory.open()
获取配置文件的名称或要打开或创建数据库的目录的名称 .如果史蒂文说的是真的,那么有两种方法可以使用BerkelyDB后端连接到数据库:
通过
bin/titan.sh
启动数据库 . 通过rexster控制台连接到数据库 .不要使用
bin/titan.sh
启动数据库 . 请改用gremlin控制台:TitanFactory.open("database-location")
. 这将打开数据库 . 但是这没有rexster服务器 . 除了gremlin控制台之外,没有其他任何东西能够访问数据库 .使用Titan Server / BerkeleyDB,您应该尝试通过RexPro或REST进行连接(Thunderdome应该通过REST连接) . 您无法打开另一个基于Titan的连接到BerkeleyDB,因为Titan Server已经拥有它 .
这与Titan Server / Cassandra不同,后者通过RexPro或REST进行连接,但也通过嵌入式Cassandra实现连接,通过
TitanFactory.open('graph')
实现连接也可以使用这两个库从python访问Titan:
https://github.com/StartTheShift/thunderdome
和
https://github.com/espeed/bulbs .
Thunderdome目前是Titan特有的,灯泡是通用的 . 在Thunderdome的维基上给出了Thunderdome和Bulbs之间的比较(可能有偏见):https://github.com/StartTheShift/thunderdome/wiki/Bulbs-VS-thunderdome
如果需要自动完成,可以使用iPython并在iPython配置中启用自动完成功能 .