Reputation: 374
I am using gremlin server with hbase as back-end.I read that for storing multiple graphs we have to go with distinct tables,so I have multiple graphs stored in hbase under different table names.
The property storage.hbase.tablename is specified in titan-hbase.properties .But I have to provide the graph dynamically depending on the group and I cannot specify the table name in hbase.properties file(there can be hundreds of graphs).
What is the way to achieve this?
Upvotes: 2
Views: 325
Reputation: 506
He still needs a way to instantiate the graph references, though. And since the user doesn't want to create/edit their .properties file, what you can do is dynamically create a Configuration object based on a "shared" properties file and append the hbase tablename as a property on that configuration object, and use the GraphFactory to instantiate the graph object. Then, you may store the graph in the GraphManager's Map named by the tablename, or whatever you like. This last step is not necessary, however, the graph being stored there gains you auto commit and rollback functionality at the end of your Gremlin script executions.
Upvotes: 1
Reputation: 46206
When using versions of TinkerPop through 3.2.4, you would have to write a wrapper around Gremlin Server where you start it with something like:
Settings settings = new Settings()
GremlinServer server = new GremlinServer(settings);
server.start().join();
Then you would manipulate the GraphManager
which you can get from the GremlinServer
instance with:
GraphManager manager = server.getServerGremlinExecutor().getGraphManager()
GraphManager.getGraphs()
returns the Map<String,Graph>
instance where you can dynamically add/remove the graphs that are being served. I would consider this method a hack/workaround to accomplish what you want, but there isn't another method.
As of 3.2.5 (as of this writing not released) and forward, GraphManager
is an interface which you can implement yourself to dynamically provide your graph list. Your implementation can be referenced in the Gremlin Server configuration file thus allowing it to be plugged into the server dynamically.
Upvotes: 2