Search code examples
titantinkerpop3

A few basic questions about getting started with Titan and Tinkerpop


This morning I decided to try out Titan. I've used both Neo4j and OrientDB, and was going to implement a polyglot persistence model using one of those graph databases; however, since I am already using Cassandra, I decided to try out Titan.

I've read through the Titan docs, as well as the Tinkerpop docs, but a few things are still unclear. Both Neo4j and OrientDB are pretty much plug-and-play; since Titan seems like more of a layer on top of a db backend like Cassandra, I'm unsure of how to start with setting it up. I can start the gremlin console and connect to my Cassandra cluster, and I can start titan server, both from the console.

My main question is, am I supposed to install titan as a service? Do I make my own init scripts, or use supervisor/monit/etc to manage it? Basically, what is the right way to keep everything running and available?


Solution

  • Titan starts as an application by itself; configuring and running embedded applications of backends (Berkeley, Embedded-Cassandra, ...) or connects to already started server or cluster of Cassandra or DynamoDB.

    This means that you can pass a single configuration file that includes all information you want Titan to use. In this config file, you could ask Titan to embed a backend (start and maintain it by itself) or connect to a local/remote instance.

    These are several examples of config files that you should have a look at.

    As a quick introduction, download Titan 1.0.0 and run its gremlin console by moving to main directory and running

    bin/gremlin.sh
    

    Inside the gremlin console, you could run something like

    TitanGraph g = TitanFactory.build().
                   set("storage.backend", "berkeleyje").
                   set("storage.directory", "/tmp/graph").
                   open();
    

    Or you could load a configuration file like this:

     TitanGraph g = TitanFactory.open("path/to/properties/file")
    

    Dive deep here.