is it possible to have multiple graphs in one titan instance?

1284 views
Skip to first unread message

Filip Melík

unread,
Feb 24, 2014, 10:28:01 AM2/24/14
to aureliu...@googlegroups.com
Hello,
I am currently starting to experiment with the Titan and I have one particular question:
Is it possible to have multiple graphs in one Titan instance?

I know that in neo4j there is no possibility of hosting two or more graphs in one neo4j instance and you have to start second instance to have another graph (i.e. there is no CREATE DATABASE-like command)

Is it the same case in Titan?

I have downloaded Rexster Titan server, and edited the rexster-cassandra-es.xml. In the <graphs> section, I have copied the content of <graph> and made a second <graph> element which has the same content as the first element except name, which I changed and thought that could eventually make a new graph.

Then I started it via titan.sh start command, went to Rexster web administration (doghouse) and there were two graphs in the graphs section, however, both of them pointed to the same graph instance (it had the same data).

Maybe it sounds like a silly approach, but I am really at the beginning. My goal is to have two graphs - one for production data, and the second one for unit tests. These graphs will be used in PHP application, so I will communicate through the REST api with gremlin queries (since there is no PHP driver for titan afaik).

Thanks and best Regards,
Filip

Stephen Mallette

unread,
Feb 24, 2014, 10:36:05 AM2/24/14
to aureliu...@googlegroups.com
Changing the <graph-name> in rexster.xml won't give you a second titan graph.  That just creates two graph instances in Rexster that point to the same Titan instance.  if you want two completely separate graphs, then you also have to change the associated configuration in rexster.xml to point at different cassandra/hbase instance or change the storage.keyspace/storage.tablename if using the same cassandra/hbase instances.


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

Daniel Kuppitz

unread,
Feb 24, 2014, 10:36:14 AM2/24/14
to aureliu...@googlegroups.com
Hi Filip,

I bet both instances use the same keyspace (assuming you're using Cassandra). Use a different setting for <storage.keyspace>...</storage.keyspace> and it should work.

Cheers,
Daniel



--

Filip Melík

unread,
Feb 25, 2014, 9:27:38 AM2/25/14
to aureliu...@googlegroups.com
Thanks to both of you, it works now, by specifying the keyspace in the configuration.

Do I understand it right that when I create a new configuration where do I specify the new keyspace (which has not been created nor used before), that the titan will create this keyspace in the cassandra silently for me and in result create a new titan graph in cassandra? Because with this behaviour it looks like this is true.

How can I then delete only the one graph (keyspace)? I know i can delete cassandra data directory, but this will delete all the keyspaces... Can I delete only the keyspaces I specify? AFAIK Cassandra has command for dropping the keyspace, but since I am using preconfigured "all in one" Rexster+Cassanddra+Titan bundle, there is no cassandra-cli.sh to run this particular command.

Thanks

Stephen Mallette

unread,
Feb 25, 2014, 9:36:26 AM2/25/14
to aureliu...@googlegroups.com
Your understand is correct.  If you want to kill one of the two graphs you have in cassandra, you will need to drop the keyspace you want to get rid of.  We don't bundle the cassandra-cli (that i know of) so you would just have to download that separately and connect to cassandra to do that.

Stephen


--

Filip Melík

unread,
Feb 26, 2014, 3:14:49 AM2/26/14
to aureliu...@googlegroups.com
Thanks a lot for clarification Stephen!
I have few last questions (hopefully) :]

1] There is a note in documentation, that you cannot change keyspace after it is defined and used. And you said that when you change the keyspace in the configuration, titan will silently create new keyspace in cassandra on background. So there is no real way how to change the keyspace in configuration, right? Is it meant that you cannot change it from cassandra CLI? But even though you change it in CLI it would be a new keyspace I think...


2] Are the titan standard indices (maybe they are called native?) stored in backend storage as well (in my case cassandra)?

3] When using elasticsearch, there is an default index of name "search" in example configuration files. However, when I look into ES, there is an index called "titan" and not "search". Does this mean that the "search" is just only for an identification used by titan and the index in ES is called "titan"?

4] When I create a second graph by introducing a new keyspace in configuration, is there a possibility to have separate indices for each of the graphs when using elasticsearch? Or is it complicated and it was never meant to have multiple graphs in one storage backend (cassandra) with different external indices (in my case ES) for each of the graphs, and you have to use only single ES index called "titan" (which is created silently by Titan) within one Titan instance for all graphs stored in the storage backend?

5] Is it better to have two different cassandra instances when I want one graph for development and one graph for unit tests? Or can I just use single cassandra instance with multiple graphs in it?


I know this is fair bit of questions, but there are still soem concepts I cannot understand. Thanks for your help :]




Dne úterý, 25. února 2014 15:36:26 UTC+1 stephen mallette napsal(a):

Stephen Mallette

unread,
Mar 3, 2014, 8:07:43 AM3/3/14
to aureliu...@googlegroups.com

1] There is a note in documentation, that you cannot change keyspace after it is defined and used. And you said that when you change the keyspace in the configuration, titan will silently create new keyspace in cassandra on background. So there is no real way how to change the keyspace in configuration, right? Is it meant that you cannot change it from cassandra CLI? But even though you change it in CLI it would be a new keyspace I think...


I guess the documentation means that altering the keyspace in the configuration file will not change an existing keyspace from a previously created graph.  It will simply create a new one leaving you with an new empty graph.
 
2] Are the titan standard indices (maybe they are called native?) stored in backend storage as well (in my case cassandra)?

yes, i believe so.
 
3] When using elasticsearch, there is an default index of name "search" in example configuration files. However, when I look into ES, there is an index called "titan" and not "search". Does this mean that the "search" is just only for an identification used by titan and the index in ES is called "titan"?

i don't know the specifics here as to how titan does that.  perhaps someone else could answer this.
 
4] When I create a second graph by introducing a new keyspace in configuration, is there a possibility to have separate indices for each of the graphs when using elasticsearch? Or is it complicated and it was never meant to have multiple graphs in one storage backend (cassandra) with different external indices (in my case ES) for each of the graphs, and you have to use only single ES index called "titan" (which is created silently by Titan) within one Titan instance for all graphs stored in the storage backend?

I guess if you wanted to share a cassandra instance with different elasticsearch indices, you would just configure it as such in the properties file (i.e. same cassandra host, different keyspaces, different ES settings). 
 
5] Is it better to have two different cassandra instances when I want one graph for development and one graph for unit tests? Or can I just use single cassandra instance with multiple graphs in it?

Generally speaking the recommendation is that a production graph should have its own cassandra cluster.  


--

Tom Michaud

unread,
Mar 3, 2014, 2:00:05 PM3/3/14
to aureliu...@googlegroups.com
Hi Filip,

Adding to Stephen's comments re: ES index-name config.  

For reference, the ES wiki docs [1] say:

This is the full list of configuration options for Elasticsearch. Note, that each of these options needs to be prefixed with storage.index.[INDEX-NAME]. where [INDEX-NAME] stands for the name of the index backend. For instance, if the index backend is named search then these configuration options need to be prefixed with storage.index.search.

[INDEX-NAME] refers to two things:

1) Configuration stanza or grouping for a given indexing backend
2) Titan index name

However, it does not define the name Elastic Search gives to the index created by Titan on behalf of you.  If you want this name to match [INDEX-NAME] then define an additional config param:

  storage.index.search.index-name=search


Tom

Filip Melík

unread,
Mar 3, 2014, 3:14:26 PM3/3/14
to aureliu...@googlegroups.com
Thanks gentlemen for making it clear.
have a nice day!

Marko Rodriguez

unread,
Mar 3, 2014, 4:37:18 PM3/3/14
to aureliu...@googlegroups.com
Hello,

Define what you mean by "multiple graphs?" You can have two disconnected graphs in the same Titan instance.

HTH,
Marko.

http://markorodriguez.com

Filip Melík

unread,
Mar 4, 2014, 3:14:09 AM3/4/14
to aureliu...@googlegroups.com
Hello Marko,


two disconnected graphs in the same Titan instance.

That is exactly what I mean
Reply all
Reply to author
Forward
0 new messages