无法连接到TitanDB - 具有相同实例ID []的Titan图已经打开。可能需要强制关机

时间:2015-11-10 14:47:35

标签: java titan gremlin

在关闭我的应用程序服务器之后,一切都运行良好,我无法连接到TitanDB。 我的连接代码:

try {
      titanGraph = TitanFactory.build()
                   .set("storage.backend", "cassandra")
                   .set("storage.hostname", titanHostname)
                   .set("graph.unique-instance-id-suffix", 99)
                   .open();
            if(titanGraph.isOpen()) {
                LOGGER.info("Success to open Titan DB");
            }
        } catch (Exception e) {
            initError(e, "Error opening Titan DB: ");
        }

我总是得到这个例外:

Caused by: com.thinkaurelius.titan.core.TitanException: A Titan graph with the same instance id [c0a838012r] is already open. Might required forced shutdown.
    at com.thinkaurelius.titan.graphdb.database.StandardTitanGraph.<init>(StandardTitanGraph.java:133)
    at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:93)
    at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:134)
    at com.ngsoft.security.auth.TitanLoginModule.connectTitanDB(TitanLoginModule.java:119)
    ... 33 more

主要问题是:

具有相同实例ID [...]的Titan图已经打开。可能需要强制关机。

重启我的电脑&amp; cassandra集群没有工作

1 个答案:

答案 0 :(得分:2)

如何从数据库中删除会话ID c0a838012r 的示例:

我们需要通过 gremlin 访问管理系统,删除实例并提交。

         \,,,/
         (o o)
-----oOOo-(_)-oOOo-----
gremlin> g = TitanFactory.open('../conf/titan-db.properties')
==>titangraph[cassandra:[10.20.30.11, 10.20.30.12]]
gremlin> mgmt = g.getManagementSystem()
==>com.thinkaurelius.titan.graphdb.database.management.ManagementSystem@c1fca2a
gremlin> mgmt.getOpenInstances()
==>c0a838019904-Yossi_c-pc1
==>c0a838012r
==>c0a838016736-Yossi_c-pc1
gremlin> mgmt.forceCloseInstance('c0a838012r')
==>null
gremlin> mgmt.commit()
==>null