-1

Is there a distributed Key-value store or Graph Database that can be integrated into a Java application.

I'm looking at Titan + BerkeleyDB but it seems it still needs a separate server.

http://titan.thinkaurelius.com/wikidoc/0.4.0/Home.html

Can Titan run in stand-alone mode and connect to other Titan nodes? If yes, how can this be configured or achieved?

Is there something like HazelCast but with a distributed persistent storage similar to Create https://crate.io/ if Titan does not work that way.

quarks
  • 33,478
  • 73
  • 290
  • 513

2 Answers2

1

You might check out Permazen.

It is basically a Java-centric persistence layer on top of a simple key/value store. Several key/value store flavors are provided.

Disclaimer: I'm the project author.

Archie
  • 4,959
  • 1
  • 30
  • 36
0

TitanDB or JanusGraph (forked from TitanDB 1.0.0) with BerkeleyDB can be used both embedded with Java or Separate Server.

If you are using maven just add these dependencies in the pom file :

<dependency>
    <groupId>com.thinkaurelius.titan</groupId>
    <artifactId>titan-core</artifactId>
    <version>1.0.0</version>
</dependency>
<dependency>
    <groupId>com.thinkaurelius.titan</groupId>
    <artifactId>titan-berkeleyje</artifactId>
    <version>1.0.0</version>
</dependency>

Sample Code :

ModifiableConfiguration config = GraphDatabaseConfiguration.buildGraphConfiguration();
config.set(GraphDatabaseConfiguration.STORAGE_BACKEND, "berkeleyje");
config.set(GraphDatabaseConfiguration.STORAGE_DIRECTORY,"data");
TitanGraph graph = TitanFactory.open(config);

TitanManagement mgmt = graph.openManagement();
mgmt.makePropertyKey("name").dataType(String.class).make();
mgmt.makeEdgeLabel("friend").make();
mgmt.commit();

TitanTransaction tx = graph.newTransaction();
Vertex ashaful = tx.addVertex("name", "Ashraful Islam");
Vertex jishnu = tx.addVertex("name", "Jishnu Banerjee");
Vertex ovi = tx.addVertex("name", "Ahsanul Haque Ovi");
ashaful.addEdge("friend", jishnu);
jishnu.addEdge("friend", ovi);
tx.commit();

GraphTraversalSource g = graph.traversal();
GraphTraversal result = g.V().has("name", "Ashraful Islam").out("friend").out("friend").values("name");
while (result.hasNext()) {
    System.out.println(result.next());
}

graph.close();

TitanDB or JanusGraph node don't communicate with each other, you have to use a common storage backend cluster (Cassandra/HBase) for all of your node so that their data is consistent.

Ashraful Islam
  • 12,470
  • 3
  • 32
  • 53
  • When running in embedded mode, is there a way for Titan to be connected as a cluster, for example, I have 3 servlets running Titan can the data be distributed into 3 nodes? – quarks Jul 16 '17 at 14:29
  • TitanDB or JanusGraph node don't communicate with each other, you have to use a common storage backend cluster (Cassandra/HBase) for all of your node so that their data is consistent. – Ashraful Islam Jul 16 '17 at 14:35
  • Looking at the docs it can work with Hazelcast for clustering: http://titan.thinkaurelius.com/wikidoc/0.4.1/Using-Hazelcast.html – quarks Jul 16 '17 at 17:19
  • @xybrek Hazelcast integration was built in in titan 0.4.1 but in version 1.0.0 Only Cassandra, HBase and BerkeleyDB has build in support – Ashraful Islam Jul 16 '17 at 17:57
  • Hello, I've also read about the embeddedcassandra which can be clustered, are you familiar with this feature? – quarks Jul 16 '17 at 18:41