quarks
quarks

Reputation: 35346

Embedded and Distributed Key Value Store or Graph Database for Java

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.

Upvotes: -1

Views: 428

Answers (2)

Archie
Archie

Reputation: 5431

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.

Upvotes: 1

Ashraful Islam
Ashraful Islam

Reputation: 12840

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.

Upvotes: 0

Related Questions