如何启动Titan图数据库服务器并连接Gremlin?

22
我已经在使用Titan图数据库服务器一段时间了。尽管有广泛的文档,但我的感觉是缺少一个从零开始的入门教程,以使内容更加通俗易懂。我的最终目标是在cassandra上运行titan并使用StartTheShift/thunderdome进行查询。
我已经看到了几种启动Titan的方法:

使用Rexster

此链接中,我能够通过以下步骤运行titan服务器:
  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>
    

对于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. 下载Rexster控制台并使用bin/rexster-console.sh运行它。
  3. 现在,您可以使用g = rexster.getGraph("geograph")连接到您的图形。

这种方法的问题是您是通过Rexster而不是Gremlin连接的,因此您没有自动完成功能。优点是您可以命名您的数据库(这里是geograph)。

使用Titan服务器与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")

这个能正常工作。

使用BerkeleyDB的Titan服务器

这个链接:

  1. 下载 titan 0.3.0
  2. 使用./bin/titan.sh config/titan-server-rexster.xml config/titan-server-berkeleydb.properties启动服务器
  3. 启动titan gremlin:./bin/gremlin.sh
  4. 但是,一旦我尝试在gremlin中使用g = TitanFactory.open('graph')连接到数据库(图形),它会在我所在的目录中创建一个名为graph的新数据库。如果我在我的目录(已填写)中执行此操作,则会出现以下错误:

    无法实例化实现:com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager

有人能澄清这些过程,并告诉我我做错了什么。 谢谢

3个回答

6
根据文档,TitanFactory.open()接受配置文件名或要打开或创建数据库的目录名称。如果Steven所说的是真的,那么有两种方法可以连接到带BerkelyDB后端的数据库:
  1. bin/titan.sh启动数据库。通过rexster控制台连接到数据库。
  2. 不使用bin/titan.sh启动数据库。改为使用gremlin控制台:TitanFactory.open("database-location")。这将打开数据库。但它没有rexster服务器。除了gremlin控制台外,没有其他任何东西能够访问数据库。

2

使用Titan Server/BerkeleyDB,您应该尝试通过RexPro或REST进行连接(Thunderdome应该通过REST进行连接)。您不能打开另一个基于Titan的BerkeleyDB连接,因为Titan Server已经拥有该连接。

这与Titan Server/Cassandra不同,在Titan Server/Cassandra中,连接发生在RexPro或REST上,但也通过嵌入式Cassandra实现了连接,从而实现了通过TitanFactory.open('graph')进行thrift连接。


1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接