I'm trying to create multiple graph instances in Janusgraph, but they all seem to have the same reference to one another, and so any action taken on one affects the others (see example below). I want to have these graphs setup as separate instances, distinct from each other, but somewhere in the steps below I'm faltering.
Steps taken to add a new graph to JanusGraph
Goal: have two graphs called graph1, graph2, with traversal objects named g1, g2, respectively, and which are distinct from one another.
Create properties files called
graph1.properties,graph2.properties. With contents (for a Cassandra backend):gremlin.graph=org.janusgraph.core.JanusGraphFactory gremlin.graph=org.janusgraph.core.ConfiguredGraphFactory storage.backend=cql storage.hostname=127.0.0.1
^ This is where I'm guessing the core issue lies - graph1.properties and graph2.properties have the same contents... but I'm unsure what to change
Add the graphs to the
gremlin-server.yamlfile, which maps to the newly createdgraph1.propertiesandgraph2.propertiesfiles.graphs: { graph1: conf/gremlin-server/graph1.properties, graph2: conf/gremlin-server/graph2.properties }Add traversal object names to the
empty-sample.groovyglobals << [g1 : graph1.traversal(), g2: graph2.traversal()]
Testing
The output below shows that the graphs were created successfully, but also shows that they are referencing eachother.
==>Configured localhost/127.0.0.1:8182-[b7696535-97d9-4b59-b30f-f83707492057]
gremlin> :remote console
==>All scripts will now be sent to Gremlin Server - [localhost/127.0.0.1:8182]-[b7696535-97d9-4b59-b30f-f83707492057] - type ':remote console' to return to local mode
gremlin> g1
==>graphtraversalsource[standardjanusgraph[cql:[127.0.0.1]], standard]
gremlin> g1.V().count()
==>100
gremlin> g2.V().count()
==>100
gremlin> g1.addV('item').property('id', '123')
==>v[327684312]
gremlin> g1.tx().commit()
==>null
gremlin> g1.V().count()
==>101
gremlin> g2.V().count()
==>101 <-- g2 should have remained at 100