Titan 0.32 and remote Elastic Search

132 views
Skip to first unread message

HunJae Lee

unread,
Nov 12, 2013, 1:42:06 AM11/12/13
to aureliu...@googlegroups.com
Hi,
I'm currently tring to add elasticsearch to my Titan/Cassandra(remote)..
After installing and running elasticsearch instances on three nodes,
I run following code snipet.
-------------
Configuration conf = new BaseConfiguration();
//Cassandra Configuration
conf.setProperty("storage.backend", "cassandra");
conf.setProperty("storage.hostname", "node1");

//Elasticsearch Configuration
conf.setProperty("storage.index.search.backend", "elasticsearch");
conf.setProperty("storage.index.search.hostname", "node1,node2,node3");
conf.setProperty("storage.index.search.index-name", "blabla");
conf.setProperty("storage.index.search.client-only", "true");
TitanGraph g = TitanFactory.open(conf);

g.commit();
g.shutdown();
---------------------------------------
Initial execution of the above code was done successfully.
However, whenever I executes the code again, below exception occurrs;
....
IndexAlreadyExistsException: [blabla] already exists.
....
What wrong am I?
Cannot the elasticsearch index be reused between Titan startups?

Matthias Broecheler

unread,
Nov 12, 2013, 8:19:42 PM11/12/13
to aureliu...@googlegroups.com
Mmh, this is strange. It seems that Titan is attempting to create the index even though it already exists. However, Titan explicitly checks for the existence before attempting to create it (see below for the relevant code).

Does it work if you remove the configuration property index-name and use the default name?

Thanks,
Matthias

        //Create index if it does not already exist
        IndicesExistsResponse response = client.admin().indices().exists(new IndicesExistsRequest(indexName)).actionGet();
        if (!response.isExists()) {
            CreateIndexResponse create = client.admin().indices().prepareCreate(indexName).execute().actionGet();
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                throw new TitanException("Interrupted while waiting for index to settle in", e);
            }
            if (!create.isAcknowledged()) throw new IllegalArgumentException("Could not create index: " + indexName);
        }



--
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.



--
Matthias Broecheler
http://www.matthiasb.com

HunJae Lee

unread,
Nov 15, 2013, 5:20:20 AM11/15/13
to aureliu...@googlegroups.com
Hi,
Yes, the same exception occurs even I remove index-name. Below is the full exception text...
------------------------------------------------------------------------------------------------------------------------------
[main] INFO com.netflix.astyanax.connectionpool.impl.ConnectionPoolMBeanManager - Registering mbean: com.netflix.MonitoredResources:type=ASTYANAX,name=ClusterTitanConnectionPool,ServiceType=connectionpool
[main] INFO com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor - AddHost: fresto2.owlab.com
[main] INFO com.netflix.astyanax.connectionpool.impl.ConnectionPoolMBeanManager - Registering mbean: com.netflix.MonitoredResources:type=ASTYANAX,name=KeyspaceTitanConnectionPool,ServiceType=connectionpool
[main] INFO com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor - AddHost: fresto2.owlab.com
[main] INFO com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor - AddHost: *************
[main] INFO com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor - AddHost: *************
[main] INFO com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor - AddHost: *************
[main] INFO com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor - RemoveHost: fresto2.owlab.com
[main] INFO com.thinkaurelius.titan.diskstorage.Backend - Configuring index [search] based on:
 backend: elasticsearch
hostname: [******, *******, ******]
client-only: true

0    [main] INFO  org.elasticsearch.plugins  - [Pretty Persuasions] loaded [], sites []
[main] INFO com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex - Configured remote host: ****** : 9300
[main] INFO com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex - Configured remote host: ****** : 9300
[main] INFO com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex - Configured remote host: ****** : 9300
Exception in thread "main" 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 TitanInitialization.initialize(TitanInitialization.java:27)
        at TitanInitialization.main(TitanInitialization.java:13)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at com.thinkaurelius.titan.diskstorage.Backend.getImplementationClass(Backend.java:263)
        ... 7 more
Caused by: org.elasticsearch.indices.IndexAlreadyExistsException: [titan] already exists
        at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.validate(MetaDataCreateIndexService.java:508)
        at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService.access$200(MetaDataCreateIndexService.java:84)
        at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$2.execute(MetaDataCreateIndexService.java:169)
        at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:298)
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:135)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:724)

Matthias Broecheler

unread,
Nov 18, 2013, 12:32:10 PM11/18/13
to aureliu...@googlegroups.com
Hey,

this is peculiar. Can you try creating the index through the REST API and then try to connect. Does that work?
Cheers,
Matthias

HunJae Lee

unread,
Nov 26, 2013, 3:55:38 AM11/26/13
to aureliu...@googlegroups.com
Hi,
Finally I solved my problem. After putting only needed JARs, that error disappeared.
Anyway, thanks for your help.

Regards.

Ty oc

unread,
Jan 28, 2014, 2:40:30 PM1/28/14
to aureliu...@googlegroups.com
The other day I have this problem too "Caused by: org.elasticsearch.indices.IndexAlreadyExistsException: [titan] already exists".

I was using gremling and perhaps deleting folders at same time making "test" perhaps I will arguee that delete the es dir and not cassandra while there was created before in the middle of a run can cause this?

Anyway it did solve not with "needed jars", but after:

  • delete "cassandra" and "es" where I run ./titan.sh or
  • ./titan.sh clean
Reply all
Reply to author
Forward
0 new messages