Gremlin Console attaching to Titan w/ Embedded Cassandra + ES

754 views
Skip to first unread message

Chris Yeung

unread,
Aug 21, 2013, 3:06:39 PM8/21/13
to aureliu...@googlegroups.com
Hi,

I'm using Titan 0.3.2. 

Please help me, I must be misunderstanding something. I'm trying to accomplish the following:

1. Run Titan Server in its own JVM, but with embedded Cassandra and embedded ElasticSearch.
2. Attach to that server using the gremlin console that is bundled with Titan.
3. Through the console, load the Graph of the Gods example into the server

To accomplish #1, I'm running this:

cd /opt/titan
bin/titan.sh config/titan-server-rexster.xml config/titan-server-cassandra-es.properties


Then to accomplish #2, I'm running this and get this error:

cd /opt/titan/bin
./gremlin.sh
gremlin> g = TitanFactory.open('cassandra-es.local')
13/08/21 14:53:14 INFO diskstorage.Backend: Configuring index [search] based on:
 backend: elasticsearch
hostname: 127.0.0.1
client-only: true

13/08/21 14:53:14 INFO elasticsearch.plugins: [Prime Mover] loaded [], sites []
13/08/21 14:53:15 INFO es.ElasticSearchIndex: Configured remote host: 127.0.0.1 : 9300
Could not instantiate implementation: com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex
Display stack trace? [yN] y
java.lang.IllegalArgumentException: Could not instantiate implementation: com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex
        at com.thinkaurelius.titan.diskstorage.Backend.getImplementationClass(Backend.java:274)
        at com.thinkaurelius.titan.diskstorage.Backend.getIndexes(Backend.java:245)
        at com.thinkaurelius.titan.diskstorage.Backend.<init>(Backend.java:98)
        at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.getBackend(GraphDatabaseConfiguration.java:440)
        at com.thinkaurelius.titan.graphdb.database.StandardTitanGraph.<init>(StandardTitanGraph.java:67)
        at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:40)
        at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:29)


I can kind of get around it if I instead open the .local file without -es. I figured that this is letting all the setup and configuration of ElasticSearch be handled by the Titan server, and that the Gremlin console need not specify it in configuration. But then when I proceed to #3, the GraphOfTheGodsFactory knows nothing about the 'search' index.


cd /opt/titan/bin
./gremlin.sh
gremlin> g = TitanFactory.open('cassandra.local')

==>titangraph[cassandrathrift:127.0.0.1]
gremlin>  GraphOfTheGodsFactory.load(g)
Index is unknown or not configured: search
Display stack trace? [yN] y
java.lang.IllegalArgumentException: Index is unknown or not configured: search
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:119)
        at com.thinkaurelius.titan.graphdb.database.StandardTitanGraph.getIndexInformation(StandardTitanGraph.java:127)
        at com.thinkaurelius.titan.graphdb.types.StandardTypeMaker.checkIndexes(StandardTypeMaker.java:115)
        at com.thinkaurelius.titan.graphdb.types.StandardTypeMaker.makePropertyKey(StandardTypeMaker.java:133)
        at com.thinkaurelius.titan.example.GraphOfTheGodsFactory.load(GraphOfTheGodsFactory.java:53)
        at com.thinkaurelius.titan.example.GraphOfTheGodsFactory$load.call(Unknown Source)

The cassandra-es.local file contains

storage.backend=cassandrathrift
storage.hostname=127.0.0.1

storage.index.search.backend=elasticsearch
storage.index.search.hostname=127.0.0.1
storage.index.search.client-only=true

The cassandra.local file contains the same as the above, minus the 3 storage.index.search lines.

What am I misunderstanding here? Are there other settings I should be feeding to the gremlin console?  Thanks in advance.



Daniel Kuppitz

unread,
Aug 21, 2013, 3:25:23 PM8/21/13
to aureliu...@googlegroups.com
Hi Chris,

use config/titan-server-cassandra.properties for the server and bin/cassandra-es.local for the client. You cannot start 2 ElasticSearch instances on the same machine. config/titan-server-cassandra-es.properties is made for distributed systems.

Cheers,
Daniel



2013/8/21 Chris Yeung <christop...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Aurelius" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aureliusgraph...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Chris Yeung

unread,
Aug 21, 2013, 3:41:08 PM8/21/13
to aureliu...@googlegroups.com
Daniel,

Thanks for the fast reply. That seems to imply that ElasticSearch is then only associated with the client.  Does that mean that under that configuration, the ElasticSearch instance would only be available while that particular client is running? If I created indices under ElasticSearch, would they persist to future sessions? 

Thanks,
Chris

Daniel Kuppitz

unread,
Aug 21, 2013, 3:54:47 PM8/21/13
to aureliu...@googlegroups.com
Hi Chris,

you can connect this server from other clients on other machines and the ES index will be available. Forgot to mention: The client on your localhost machine should then have this configuration setting:

storage.index.search.client-only=false

However, this implies that if you close the client connection, your ES server will also be closed. Then you would need to restart the server with config/titan-server-cassandra-es.properties.
It's quite tricky to run everything on a single machine. Start a new VM for ElasticSearch and life will be a lot easier :). For testing purposes you don't even need to start a server. Simply open your Gremlin REPL, type

g = TitanFactory.open("config/titan-server-cassandra-es.properties")

...and you're ready to go.


Cheers,
Daniel


Reply all
Reply to author
Forward
0 new messages