How to dynamically load graph with multiple keyspace with remote Janus server

77 views
Skip to first unread message

Saini Datta

unread,
Jun 28, 2019, 7:35:41 AM6/28/19
to JanusGraph users
Hi,

I am developing a java application where there is a requirement, depending upon input, load a graph of particular keyspace. Janus server is running remotely. I am unable to do it through ConfiguredGraphFactory as the client is not getting the class instance of ConfiguredGraphFactory created by remote server and hence throwing the exception :
"java.lang.RuntimeException: org.janusgraph.graphdb.management.utils.ConfigurationManagementGraphNotEnabledException: Please add a key named "ConfigurationManagementGraph" to the "graphs" property in your YAML file and restart the server to be able to use the functionality of the ConfigurationManagementGraph class."

I have the following queries:
               1. Is there any way to connect remote server to get graph instance using ConfiguredGraphFactory? I know about withRemote(config) but it works only on traversal.
               2. Is there any alternative approach where I can load a particular keyspace graph dynamically from java client.

Please guide..

Thanks
Saini

Satyajit Bhadange

unread,
Jun 28, 2019, 5:19:27 PM6/28/19
to janusgra...@googlegroups.com
Hi,

This works for me.
When I start my service I also start Gremlin Server with below-mentioned configuration.

private void startGremlin() throws Exception {
final InputStream stream = this.getClass().getResourceAsStream("/gremlin-server.yaml");
this.gremlinServer = new GremlinServer(Settings.read(stream));

gremlinServer.start();

Map<String, Object> map = new HashMap<>();
map.put("storage.backend", "hbase");

ConfiguredGraphFactory.updateTemplateConfiguration(new MapConfiguration(map));
}
Note: createTemplateConfiguration was giving me run time errors so that's why using updateTemplateConfiguration instead.

Once the server is started you can access different graph by providing the only graphName. 

public JanusGraph getGraph(String graphName) {
if (!ConfiguredGraphFactory.getGraphNames().contains(graphName)) {
ConfiguredGraphFactory.create(graphName);
}
g = ConfiguredGraphFactory.open(graphName);
return g;
}

gremlin.yaml
graphManager: org.janusgraph.graphdb.management.JanusGraphManager
graphs: {
graph: janusgraph-hbase.properties,
ConfigurationManagementGraph: janusGraph-configurationmanagement.properties
}

janusGraph-configurationmanagement.properties
gremlin.graph=org.janusgraph.core.JanusGraphFactory
graph.graphname=ConfigurationManagementGraph
storage.backend=hbase
storage.hostname=localhost
storage.hbase.table=Janus
janusgraph-hbase.properties
storage.backend=hbase
storage.hostname=localhost
storage.hbase.table=Janus

Regards,
Satyajit Bhadange


--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/5c30aa6e-97f1-4392-aaff-2356e498a3e8%40googlegroups.com.

Abhijeet Kumar

unread,
Jul 8, 2020, 8:11:08 AM7/8/20
to JanusGraph users
+1
Reply all
Reply to author
Forward
0 new messages