问题
I would like to be able to specify the neo4j (2.0+) database folder when I open a connection to a graph using bulbs. The goal is to be able to open different or multiple neo4j databases (folders in data/) on the same machine without starting the neo4j server. This works with the Gremlin console. I suspect the route to doing this with bulbs would be to use the bulbs Rexster client (http://bulbflow.com/docs/api/bulbs/rexster/client/) and somehow automatically start a Rexster server pointing to the folder. Has anybody done this or can anyone contribute advice toward such goals?
many thanks
回答1:
Bulbs was designed to make it easy to work with multiple graph databases.
Configure your rexster.xml
for each Neo4j database you want to run (each will have a different name and thus a different URL path), and then create a separate Bulbs Config
and Graph
object for each database:
>>> from bulbs.rexster import Graph, Config
>>>
>>> config = Config('http://localhost:8182/graphs/somegraph')
>>> g1 = Graph(config)
>>>
>>> config = Config('http://localhost:8182/graphs/anothergraph')
>>> g2 = Graph(config)
Here are the relevant docs...
Rexster Configuration (rexster.xml)
https://github.com/tinkerpop/rexster/wiki/Rexster-Configuration
Rexster/Neo4j2 Configuration
https://github.com/tinkerpop/rexster/wiki/Specific-Graph-Configurations#neo4j2
Bulbs Config
http://bulbflow.com/docs/api/bulbs/config/
来源:https://stackoverflow.com/questions/24315615/possible-to-connect-to-multiple-neo4j-databases-via-bulbs-rexster