【问题标题】:Not loading data from titan graph with cassandra backend using gremlin.不使用 gremlin 从带有 cassandra 后端的 Titan 图加载数据。
【发布时间】:2015-11-11 07:36:56
【问题描述】:

我使用带有 java 的 blueprint api 在 Titan(cassandra 后端) 中添加了数据。我在java中使用了以下配置来插入数据。

 TitanGraph getTitanGraph()
{
    conf2 = new BaseConfiguration();
    conf2.setProperty("storage.backend", "cassandra");
    conf2.setProperty("storage.directory","/some/directory");
    conf2.setProperty("storage.read-only", "false");
    conf2.setProperty("attributes.allow-all", true);
    return TitanFactory.open(conf2);
}

现在我正在尝试使用 gremlin 查询该数据库。我使用以下 cmd 加载它

 g = TitanFactory.open("bin/cassandra.local");

以下是我的 cassandra.local 文件

 conf = new BaseConfiguration();
 conf.setProperty("storage.backend","cassandra");
 conf.setProperty("storage.hostname","127.0.0.1");
 conf.setProperty("storage.read-only", "false");
 conf.setProperty("attributes.allow-all", true)

但是当我运行“g.V”时,我得到的是空图。请帮忙

谢谢

【问题讨论】:

    标签: cassandra titan gremlin tinkerpop-blueprint


    【解决方案1】:

    确保在 Java 程序中进行图形突变后将更改提交到 TitanGraph。如果您使用的是Titan 0.5.x,则呼叫为graph.commit()。如果您使用的是Titan 0.9.x,则呼叫为graph.tx().commit()

    请注意,storage.directory 对 Cassandra 后端无效,但 storage.hostname 的默认值为 127.0.0.1,因此您的 Java 程序和 cassandra.local 之间的值应该相同。使用属性文件来存储连接属性可能更容易。

    【讨论】:

    • 谢谢。我使用相同的配置文件并全部更改为titan0.5.4。 Thant 解决了这个问题。
    猜你喜欢
    • 1970-01-01
    • 2016-10-05
    • 2016-08-04
    • 2017-10-17
    • 2015-12-30
    • 2016-09-03
    • 2016-05-15
    • 1970-01-01
    • 2013-10-28
    相关资源
    最近更新 更多