简体   繁体   English

泰坦蓝图Rexster

[英]Titan BluePrints Rexster

Revision: 修订版:

I have a stand-alone version of Cassandra. 我有Cassandra的独立版本。 I launch that using the following command: 我使用以下命令启动该命令:

./cassandra -f

I also have a Java Application that the Titan Graph Library installed. 我还安装了Titan Graph Library的Java应用程序。 To obtain a TitanGraph object I use the following code: 为了获得TitanGraph对象,我使用以下代码:

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

After this I can add Vertices/Edges and Query them as well. 之后,我可以添加“顶点/边”并对其进行查询。 I did an additional check on the local Cassandra database and can verify there are records being generated and persisted 我对本地Cassandra数据库进行了额外的检查,可以验证是否有记录正在生成并保持不变

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

 count
--------
 185050

(1 rows)

The problem arises when I launch the rexster-server. 当我启动rexster-server时出现问题。 I am launching this in stand-alone mode using the following command: 我使用以下命令以独立模式启动它:

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

Then I launch the rexster console and load the graph. 然后,我启动rexster控制台并加载图形。 The issues is that the graph seems to contain no data? 问题在于图表似乎不包含任何数据? I am really not sure what is going on here. 我真的不确定这里发生了什么。 There is only 1 instance of Cassandra running. 只有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]> 

Below is the rexster.xml I am using 以下是我正在使用的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>

Perhaps there is just some confusion in Rexster's role. 也许Rexster的角色有些混乱。 Your question was: 您的问题是:

My issue is that when I instantiate an TitanGraph using the TitanFactory as seen below there does not seem to be the option to specify the graph name? 我的问题是,当我使用如下所示的TitanFactory实例化TitanGraph时,似乎没有指定图形名称的选项?

Note that using TitanFactory will open a TitanGraph instance that connects directly to cassandra. 请注意,使用TitanFactory将打开直接连接到cassandra的TitanGraph实例。 That has nothing to do with Rexster. 这与Rexster无关。 If you want to connect to Rexster (which remotely holds a TitanGraph instance given your configuration) then you must do so through REST or RexPro. 如果要连接到Rexster(根据您的配置远程保存一个TitanGraph实例),则必须通过REST或RexPro进行连接。 With the more simple approach for verifying operations being REST, try to curl: 使用更简单的方法来验证操作是否为REST,尝试卷曲:

curl http://localhost:8182/graphs

That should return some JSON that contains the name of the TitanGraph instance you configured in the <graph-name> field in rexster.xml . 这应该返回一些JSON包含的名称TitanGraph您在配置实例<graph-name>字段rexster.xml The <graph-name> simply identifies the graph instance in Rexster so that you can uniquely identify it in requests when there are multiple instances hosted in there. <graph-name>只是在Rexster中标识图实例,以便在其中托管多个实例时可以在请求中唯一标识它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM