问题描述
我一直在玩 Titan图形服务器已有一段时间了.我的感觉是,尽管有大量的文档,但缺少从头开始教程.
我的最终目标是在cassandra上运行一个titan,并使用 StartTheShift/thunderdome 进行查询.. >
我见过几种启动泰坦的方法:
使用Rexster
来自此链接,我能够运行一个titan服务器执行以下步骤:
- 下载 rexster服务器2.3
- 下载 titan 0.3.0
- 将所有文件从
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数据库.
- 使用
./bin/rexster.sh -s -c rexster.xml
启动服务器 - 下载rexster控制台并使用
bin/rexster-console.sh
运行它 - 您现在可以使用
g = rexster.getGraph("geograph")
连接到图形
此方法的问题在于您是通过rexster连接的,而不是通过gremlin连接的,因此您没有自动补全功能.优点是您可以命名数据库(在此处为地理位置).
将Titan服务器与cassandra一起使用
- 使用
./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一起使用
来自此链接:
- 下载 titan 0.3.0
- 使用
./bin/titan.sh config/titan-server-rexster.xml config/titan-server-berkeleydb.properties
启动服务器 - 发射泰坦·格雷姆林:
./bin/gremlin.sh
-
,但是一旦我尝试使用
g = TitanFactory.open('graph')
连接到gremlin中的数据库(图形),它就会在我所在的目录中创建一个名为graph的新数据库.我得到:
有人可以弄清楚这些过程,然后告诉我我做错了什么.谢谢
根据文档TitanFactory.open()
可以使用配置文件的名称或要在其中打开或创建数据库的目录的名称.
如果steven所说的是正确的,那么有两种方法可以通过BerkelyDB后端连接到数据库:
-
通过
bin/titan.sh
启动数据库.通过rexster控制台连接到数据库. -
请勿使用
bin/titan.sh
启动数据库.改用gremlin控制台:TitanFactory.open("database-location")
.这将打开数据库.但这没有rexster服务器.除了gremlin控制台之外,其他任何东西都将无法访问数据库.
I've been playing with Titan graph server for a while now. And my feeling is that, despite an extensive documentation, there is a lack of Getting started from scratch tutorial.
My final goal is to have a titan running on cassandra and query with StartTheShift/thunderdome.
I have seen few ways of starting Titan:
Using Rexster
from this link, I was able to run a titan server with the following steps:
- download rexster-server 2.3
- download titan 0.3.0
- copy all files from
titan-all-0.3.0/libs
torexster-server-2.3.0/ext/titan
edit
rexster-server-2.3.0/rexster.xml
and add (between 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>
for a berkeleydbor:
<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>
for a cassandra db.
- launch the server with
./bin/rexster.sh -s -c rexster.xml
- dowload rexster console and run it with
bin/rexster-console.sh
- you can now connect to your graph with
g = rexster.getGraph("geograph")
The problem with this method is that you are connected via rexster and not gremlin so you do not have autocompletion. The advantage is that you can name your database (here geograph).
Using Titan server with cassandra
- start the server with
./bin/titan.sh config/titan-server-rexster.xml config/titan-server-cassandra.properties
create a file called
cassandra.local
withstorage.backend=cassandrathrift storage.hostname=127.0.0.1
start titan gremlin and connect with
g = TitanFactory.open("cassandra-es.local")
this works fine.
Using titan server with BerkeleyDB
From this link:
- download titan 0.3.0
- start the server with
./bin/titan.sh config/titan-server-rexster.xml config/titan-server-berkeleydb.properties
- launch titan gremlin:
./bin/gremlin.sh
but once I try to connect to the database (graph) in gremlin with
g = TitanFactory.open('graph')
it creates a new database called graph in the directory I'm in. If i execute this where my directory (filled) is I get:
Could someone clarify these process, and tell me what I'm doing wrong.Thanks
According to the documentation TitanFactory.open()
takes either the name of a config file or the name of a directory to open or create a database in.
If what steven says is true, there would be two ways to connect to the database with a BerkelyDB backend:
Start the database through
bin/titan.sh
. Connect to the database through the rexster console.DON'T start the database using
bin/titan.sh
. Use the gremlin console instead:TitanFactory.open("database-location")
. This will open the database. But this does not have a rexster server. Nothing else will be able to access the database but the gremlin console.
这篇关于如何启动Titan图形服务器并与gremlin连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!