0

修订:

我有一个独立版本的 Cassandra。我使用以下命令启动它:

./cassandra -f

我还有一个安装了 Titan Graph Library 的 Java 应用程序。要获得 TitanGraph 对象,我使用以下代码:

BaseConfiguration configuration = new BaseConfiguration();
configuration.setProperty("storage.backend", "cassandra");
configuration.setProperty("storage.hostname", "127.0.0.1");
TitanGraph graph = TitanFactory.open(configuration);

在此之后,我可以添加顶点/边并查询它们。我对本地 Cassandra 数据库进行了额外检查,可以验证是否有记录正在生成和持久化

cqlsh> select count(*) from titan.edgestore;

 count
--------
 185050

(1 rows)

当我启动 rexster-server 时出现问题。我使用以下命令以独立模式启动它:

./rexster.sh -s -c ../config/rexster.xml

然后我启动 rexster 控制台并加载图表。问题是图表似乎不包含数据?我真的不确定这里发生了什么。只有 1 个 Cassandra 实例正在运行。

        (l_(l
(_______( 0 0
(        (-Y-) <woof>
l l-----l l
l l,,   l l,,
opening session [127.0.0.1:8184]
?h for help

rexster[groovy]> ?h
-= Console Specific =-
?<language-name>: jump to engine
?l: list of available languages on Rexster
?b: print available bindings in the session
?r: reset the rexster session
?e <file-name>: execute a script file
?q: quit
?h: displays this message

-= Rexster Context =-
rexster.getGraph(graphName) - gets a Graph instance
   :graphName - [String] - the name of a graph configured within Rexster
rexster.getGraphNames() - gets the set of graph names configured within Rexster
rexster.getVersion() - gets the version of Rexster server

rexster[groovy]> rexster.getGraphNames() 
==>kpdlp
rexster[groovy]> rexster.getGraph('graph')
==>titangraph[cassandrathrift:[127.0.0.1]]
rexster[groovy]> g = rexster.getGraph('graph')
==>titangraph[cassandrathrift:[127.0.0.1]]
rexster[groovy]> g.V.count()
==>0
rexster[groovy]> 

下面是我正在使用的 rexster.xml

  <?xml version="1.0" encoding="UTF-8"?>
<rexster>
    <http>
        <server-port>8182</server-port>
        <server-host>0.0.0.0</server-host>
        <base-uri>http://localhost</base-uri>
        <web-root>public</web-root>
        <character-set>UTF-8</character-set>
        <enable-jmx>false</enable-jmx>
        <enable-doghouse>true</enable-doghouse>
        <max-post-size>2097152</max-post-size>
        <max-header-size>8192</max-header-size>
        <upload-timeout-millis>30000</upload-timeout-millis>
        <thread-pool>
            <worker>
                <core-size>8</core-size>
                <max-size>8</max-size>
            </worker>
            <kernal>
                <core-size>4</core-size>
                <max-size>4</max-size>
            </kernal>
        </thread-pool>
        <io-strategy>leader-follower</io-strategy>
    </http>
    <rexpro>
        <server-port>8184</server-port>
        <server-host>0.0.0.0</server-host>
        <session-max-idle>1790000</session-max-idle>
        <session-check-interval>3000000</session-check-interval>
        <read-buffer>65536</read-buffer>
        <enable-jmx>false</enable-jmx>
        <thread-pool>
            <worker>
                <core-size>8</core-size>
                <max-size>8</max-size>
            </worker>
            <kernal>
                <core-size>4</core-size>
                <max-size>4</max-size>
            </kernal>
        </thread-pool>
        <io-strategy>leader-follower</io-strategy>
    </rexpro>
    <shutdown-port>8183</shutdown-port>
    <shutdown-host>127.0.0.1</shutdown-host>
    <config-check-interval>10000</config-check-interval>
    <script-engines>
        <script-engine>
            <name>gremlin-groovy</name>
            <reset-threshold>-1</reset-threshold>
            <init-scripts>config/init.groovy</init-scripts>
            <imports>com.tinkerpop.rexster.client.*</imports>
            <static-imports>java.lang.Math.PI</static-imports>
        </script-engine>
    </script-engines>
    <security>
        <authentication>
            <type>none</type>
            <configuration>
                <users>
                    <user>
                        <username>rexster</username>
                        <password>rexster</password>
                    </user>
                </users>
            </configuration>
        </authentication>
    </security>
    <metrics>
        <reporter>
            <type>jmx</type>
        </reporter>
        <reporter>
            <type>http</type>
        </reporter>
        <reporter>
            <type>console</type>
            <properties>
                <rates-time-unit>SECONDS</rates-time-unit>
                <duration-time-unit>SECONDS</duration-time-unit>
                <report-period>10</report-period>
                <report-time-unit>MINUTES</report-time-unit>
                <includes>http.rest.*</includes>
                <excludes>http.rest.*.delete</excludes>
            </properties>
        </reporter>
    </metrics>
    <graphs>
<graph>
    <graph-name>graph</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>cassandrathrift</storage.backend>
          <storage.hostname>127.0.0.1</storage.hostname>
    </properties>
    <extensions>
      <allows>
        <allow>tp:gremlin</allow>
      </allows>
    </extensions>
  </graph>
    </graphs>
</rexster>
4

1 回答 1

0

也许 Rexster 的角色有些混乱。你的问题是:

我的问题是,当我使用 TitanFactory 实例化 TitanGraph 时,如下所示,似乎没有指定图形名称的选项?

请注意,使用TitanFactory将打开一个TitanGraph直接连接到 cassandra 的实例。这与 Rexster 无关。如果您想连接到 Rexster(TitanGraph根据您的配置远程保存一个实例),那么您必须通过 REST 或 RexPro 进行。使用 REST 验证操作的更简单方法,尝试 curl:

curl http://localhost:8182/graphs

这应该返回一些 JSON,其中包含TitanGraph<graph-name>rexster.xml. 简单地标识 Rexster 中的<graph-name>图形实例,以便当其中托管多个实例时,您可以在请求中唯一标识它。

于 2014-12-17T11:59:56.510 回答