Skip to content
mbroecheler edited this page Jun 6, 2012 · 40 revisions

Cassandra is a Dynamo BigTable implementation…

Deploying on Managed Machines

The following sections outline the various ways in which Titan can be used in concert with Cassandra.

Using in Embedded Mode

Cassandra can be run in embedded mode where the application has direct access to the Cassandra instance within the same Java Virtual Machine (JVM). The diagram above demonstrates how Titan and Cassandra directly communicate with each other via Java method invocations. Finally, the end application directly communicates with Titan. For graph application that do not need to scale beyond the confines of a single machine, significant speed improvements are realized as all components are communicating via direct JVM references.

Graph graph = new TitanGraph("/tmp/titan");

Using Local Server Mode

Cassandra can be run as a standalone database on the same local host as Titan and the end-user application. In this model, Titan and Cassandra communicate with one another via a localhost socket. Running Titan over Cassandra requires the following setup steps:

  1. Download, unpack, and setup Cassandra on your local machine.
  2. Start Cassandra by invoking bin/cassandra -f on the command line in the directory where Cassandra was unpacked. Ensure that Cassandra started successfully.

Now, you can create a Cassandra TitanGraph as follows:

Configuration conf = new BaseConfiguration();
conf.setProperty("storage.backend","cassandra");
conf.setProperty("storage.hostname","127.0.0.1");
TitanGraph g = TitanFactory.open(conf);

Using Remote Server Mode

When the graph needs to scale beyond the confines of a single machine, then Cassandra and Titan are logically separated into different machines. In this model, the Cassandra cluster maintains the graph representation and any number of Titan instances maintain socket-based read/write access to the Cassandra cluster. The end-user application can directly interact with Titan within the same JVM as Titan.

For example, suppose we have a running Cassandra cluster where one of the machines has the IP address 77.77.77.77, then connecting Titan with the cluster is accomplished as follows:

Configuration conf = new BaseConfiguration();
conf.setProperty("storage.backend","cassandra");
conf.setProperty("storage.hostname","77.77.77.77");
TitanGraph g = TitanFactory.open(conf);

Using Remote Server Mode with Rexster

Finally, Rexster can be wrapped around each Titan instance defined in the previous subsection. In this way, the end-user application need not be a Java-based application as it can communicate with Rexster over REST. This type of deployment is great for polyglot architectures where various components written in different languages need to reference and compute on the graph.

http://rexster.titan.machine1/mygraph/vertices/1
http://rexster.titan.machine2/mygraph/tp/gremlin?script=g.v(1).out('follows').out('created')

Deploying on Amazon EC2

Amazon EC2 is a cloud computing service…