本文介绍了如何启动Titan图形服务器并与gremlin连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在玩 Titan图形服务器已有一段时间了.我的感觉是,尽管有大量的文档,但缺少从头开始教程.

我的最终目标是在cassandra上运行一个titan,并使用 StartTheShift/thunderdome 进行查询.. >

我见过几种启动泰坦的方法:

使用Rexster

来自此链接,我能够运行一个titan服务器执行以下步骤:

  1. 下载 rexster服务器2.3
  2. 下载 titan 0.3.0
  3. 将所有文件从titan-all-0.3.0/libs复制到rexster-server-2.3.0/ext/titan
  4. 编辑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数据库.

  1. 使用./bin/rexster.sh -s -c rexster.xml
  2. 启动服务器
  3. 下载rexster控制台并使用bin/rexster-console.sh
  4. 运行它
  5. 您现在可以使用g = rexster.getGraph("geograph")
  6. 连接到图形

此方法的问题在于您是通过rexster连接的,而不是通过gremlin连接的,因此您没有自动补全功能.优点是您可以命名数据库(在此处为地理位置).

将Titan服务器与cassandra一起使用

  1. 使用./bin/titan.sh config/titan-server-rexster.xml config/titan-server-cassandra.properties
  2. 启动服务器
  3. 使用

    创建一个名为cassandra.local的文件

    storage.backend=cassandrathrift
    storage.hostname=127.0.0.1
    

  4. 启动titan gremlin并与g = TitanFactory.open("cassandra-es.local")

  5. 连接

这很好.

将titan服务器与BerkeleyDB一起使用

来自此链接:

  1. 下载 titan 0.3.0
  2. 使用./bin/titan.sh config/titan-server-rexster.xml config/titan-server-berkeleydb.properties
  3. 启动服务器
  4. 发射泰坦·格雷姆林:./bin/gremlin.sh
  5. ,但是一旦我尝试使用g = TitanFactory.open('graph')连接到gremlin中的数据库(图形),它就会在我所在的目录中创建一个名为graph的新数据库.我得到:

有人可以弄清楚这些过程,然后告诉我我做错了什么.谢谢

解决方案

根据文档TitanFactory.open()可以使用配置文件的名称或要在其中打开或创建数据库的目录的名称.

如果steven所说的是正确的,那么有两种方法可以通过BerkelyDB后端连接到数据库:

  1. 通过bin/titan.sh启动数据库.通过rexster控制台连接到数据库.

  2. 请勿使用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:

  1. download rexster-server 2.3
  2. download titan 0.3.0
  3. copy all files from titan-all-0.3.0/libs to rexster-server-2.3.0/ext/titan
  4. 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.

  1. launch the server with ./bin/rexster.sh -s -c rexster.xml
  2. dowload rexster console and run it with bin/rexster-console.sh
  3. 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

  1. start the server with ./bin/titan.sh config/titan-server-rexster.xml config/titan-server-cassandra.properties
  2. create a file called cassandra.local with

    storage.backend=cassandrathrift
    storage.hostname=127.0.0.1
    

  3. start titan gremlin and connect with g = TitanFactory.open("cassandra-es.local")

this works fine.

Using titan server with BerkeleyDB

From this link:

  1. download titan 0.3.0
  2. start the server with ./bin/titan.sh config/titan-server-rexster.xml config/titan-server-berkeleydb.properties
  3. launch titan gremlin: ./bin/gremlin.sh
  4. 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:

  1. Start the database through bin/titan.sh. Connect to the database through the rexster console.

  2. 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连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 14:56