Titan uses the Gremlin Server engine as the server component to process and answer client queries.
Gremlin Server provides a way to remotely execute Gremlin scripts against one or more Titan instances hosted within it. By default, client applications can connect to it via WebSockets with a custom subprotocol (there are a number of clients developed in different languages to help support the subprotocol). Gremlin Server can also be configured to serve a simple REST-style endpoint for processing Gremlin as well. These configurations just represent the out-of-the-box options for Gremlin Server. It is certainly possible to also extend it with other means of communication by implementing the interfaces that it provides.
- Download a copy of the current
titan-$VERSION.zipfile from the Downloads page
- Unzip it and enter the
bin/titan.sh start. This step will start Gremlin Server with Cassandra/ES forked into a separate process.
$ bin/titan.sh start Forking Cassandra... Running `nodetool statusthrift`.. OK (returned exit status 0 and printed string "running"). Forking Elasticsearch... Connecting to Elasticsearch (127.0.0.1:9300)... OK (connected to 127.0.0.1:9300). Forking Gremlin-Server... Connecting to Gremlin-Server (127.0.0.1:8182)... OK (connected to 127.0.0.1:8182). Run gremlin.sh to connect.
Gremlin Server will be ready to listen for WebSocket connections when it is started. The easiest way to test the connection is with Gremlin Console.
Start Gremlin Console with
bin/gremlin.sh and use the
:> commands to issue Gremlin to Gremlin Server:
$ bin/gremlin.sh \,,,/ (o o) -----oOOo-(3)-oOOo----- plugin activated: tinkerpop.server plugin activated: tinkerpop.hadoop plugin activated: tinkerpop.utilities plugin activated: aurelius.titan plugin activated: tinkerpop.tinkergraph gremlin> :remote connect tinkerpop.server conf/remote.yaml ==>Connected - localhost/127.0.0.1:8182 gremlin> :> graph.addVertex("name", "stephen") ==>v gremlin> :> g.V().values('name') ==>stephen
:remote command tells the console to configure a remote connection to Gremlin Server using the
conf/remote.yaml file to connect. That file points to a Gremlin Server instance running on
:> is the "submit" command which sends the Gremlin on that line to the currently active remote.
To start Titan Server with the REST API, find the