Reputation: 3523
Everything worked well until after a shutdown of my application server I could not connect to TitanDB. My connection code:
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: ");
}
I always get this exception:
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
the main issue is:
A Titan graph with the same instance id [...] is already open. Might required forced shutdown.
Reboot my pc & the cassandra cluster didn't worked
Upvotes: 1
Views: 1501
Reputation: 3523
Example for how to remove session id c0a838012r from the database:
we need to access the management system via gremlin, remove the instance and commit.
\,,,/
(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
Upvotes: 3