Multiple Graphs with Embedded JanusGraph

Hello!! I am using embedded Janusgraph (embedded JanusGraph as a library inside my Java Application). I am trying to figure out if I can write two different named graphs to the same database. I am trying to use https://docs.janusgraph.org/operations/configured-graph-factory/ to create multiple graphs. I set the name of the graph in graph.graphname in my JanusGraph configuration. But I get the following error while opening the graph
Gremlin Server must be configured to use the JanusGraphManager.
Gremlin Server must be configured to use the JanusGraphManager.
But I don't use the gremlin server and I am using embedded janusgraph. Can I create multiple dynamic graphs in the same storage ?
5 Replies
deepak8347
deepak834716mo ago
A yaml representation of my janusgraph config is
janusGraphConfig:
storage:
backend: "com.company.department.diskstorage.cassandra.CompanyCassandraStoreManager"
batch-loading: true
query:
batch: true
batch-property-prefetch: true
fast-property: true
force-index: false
graph:
graphname: test-graph
replace-instance-if-exists: true
ids:
block-size: 100000000
janusGraphConfig:
storage:
backend: "com.company.department.diskstorage.cassandra.CompanyCassandraStoreManager"
batch-loading: true
query:
batch: true
batch-property-prefetch: true
fast-property: true
force-index: false
graph:
graphname: test-graph
replace-instance-if-exists: true
ids:
block-size: 100000000
Bo
Bo16mo ago
Before you call ConfiguredGraphFactory..., do this:
JanusGraphManager gm = new JanusGraphManager(new Settings());
JanusGraphManager gm = new JanusGraphManager(new Settings());
You don't really need gm instance though - it's designed for JanusGraph server. Using JanusGraph as a library gives you more flexibility. So alternatively, you could just manage the graphs by yourself and use JanusGraphFactory.open(config) with different config to open different graphs. ConfiguredGraphFactory essentially does the same thing, except that it also needs to persist the graph configs.
deepak8347
deepak834716mo ago
Creating JanusGraphManager this way solved the issue. I thought that we can create two dynamic graphs in the same keyspace, but that is not the case right ?
Bo
Bo16mo ago
Glad to hear it worked. No we don't do that. One graph per keyspace is the way to isolate different graphs.
deepak8347
deepak834716mo ago
Thanks for answering, this helped!!
Want results from more Discord servers?
Add your server