Skip to content

Neo4jHa Implementation

jbmusso edited this page Jul 12, 2016 · 9 revisions

Attention: this Wiki hosts an outdated version of the TinkerPop framework and Gremlin language documentation.


<dependency>
   <groupId>com.tinkerpop.blueprints</groupId>
   <artifactId>blueprints-neo4j-graph</artifactId>
   <version>??</version>
</dependency>
Map<String, String> configuration = new HashMap<String, String>();
configuration.put("ha.machine_id", "1");
configuration.put("ha.server", "localhost:6001");
configuration.put("ha.initial_hosts", "localhost:2181,localhost:2182,localhost:2183");
Graph graph = new Neo4jHaGraph("/tmp/neo4j", configuration);

Neo4jHaGraph provides support for the Neo4j High Availability Cluster which provides a fault-tolerant database structure and horizontal scaling capability. Instantiating the Neo4jHaGraph class requires several configuration elements as shown in the sample above. Setting up the cluster is described here.

GraphFactory Settings

If using GraphFactory to instantiate a Neo4jHaGraph, the following properties will apply:

key description
blueprints.graph com.tinkerpop.blueprints.impls.neo4j.Neo4jHaGraph
blueprints.neo4jha.directory The directory of the Neo4jHaGraph instance.
blueprints.neo4jha.conf.* The prefix to use for any Neo4j HA specific settings (e.g. blueprints.neo4jha.config.machine_id).

Warning: GraphFactory uses Apache Configuration to parse configuration files. Commas will be interpreted as list delimiters. Be sure to escape commas when specifying property values using a \.