Revision:
I have a stand-alone version of Cassandra. I launch that using the following command:
./cassandra -f
I also have a Java Application that the Titan Graph Library installed. To obtain a TitanGraph object I use the following code:
BaseConfiguration configuration = new BaseConfiguration();
configuration.setProperty("storage.backend", "cassandra");
configuration.setProperty("storage.hostname", "127.0.0.1");
TitanGraph graph = TitanFactory.open(configuration);
After this I can add Vertices/Edges and Query them as well. I did an additional check on the local Cassandra database and can verify there are records being generated and persisted
cqlsh> select count(*) from titan.edgestore;
count
--------
185050
(1 rows)
The problem arises when I launch the rexster-server. I am launching this in stand-alone mode using the following command:
./rexster.sh -s -c ../config/rexster.xml
Then I launch the rexster console and load the graph. The issues is that the graph seems to contain no data? I am really not sure what is going on here. There is only 1 instance of Cassandra running.
(l_(l
(_______( 0 0
( (-Y-) <woof>
l l-----l l
l l,, l l,,
opening session [127.0.0.1:8184]
?h for help
rexster[groovy]> ?h
-= Console Specific =-
?<language-name>: jump to engine
?l: list of available languages on Rexster
?b: print available bindings in the session
?r: reset the rexster session
?e <file-name>: execute a script file
?q: quit
?h: displays this message
-= Rexster Context =-
rexster.getGraph(graphName) - gets a Graph instance
:graphName - [String] - the name of a graph configured within Rexster
rexster.getGraphNames() - gets the set of graph names configured within Rexster
rexster.getVersion() - gets the version of Rexster server
rexster[groovy]> rexster.getGraphNames()
==>kpdlp
rexster[groovy]> rexster.getGraph('graph')
==>titangraph[cassandrathrift:[127.0.0.1]]
rexster[groovy]> g = rexster.getGraph('graph')
==>titangraph[cassandrathrift:[127.0.0.1]]
rexster[groovy]> g.V.count()
==>0
rexster[groovy]>
Below is the rexster.xml I am using
<?xml version="1.0" encoding="UTF-8"?>
<rexster>
<http>
<server-port>8182</server-port>
<server-host>0.0.0.0</server-host>
<base-uri>http://localhost</base-uri>
<web-root>public</web-root>
<character-set>UTF-8</character-set>
<enable-jmx>false</enable-jmx>
<enable-doghouse>true</enable-doghouse>
<max-post-size>2097152</max-post-size>
<max-header-size>8192</max-header-size>
<upload-timeout-millis>30000</upload-timeout-millis>
<thread-pool>
<worker>
<core-size>8</core-size>
<max-size>8</max-size>
</worker>
<kernal>
<core-size>4</core-size>
<max-size>4</max-size>
</kernal>
</thread-pool>
<io-strategy>leader-follower</io-strategy>
</http>
<rexpro>
<server-port>8184</server-port>
<server-host>0.0.0.0</server-host>
<session-max-idle>1790000</session-max-idle>
<session-check-interval>3000000</session-check-interval>
<read-buffer>65536</read-buffer>
<enable-jmx>false</enable-jmx>
<thread-pool>
<worker>
<core-size>8</core-size>
<max-size>8</max-size>
</worker>
<kernal>
<core-size>4</core-size>
<max-size>4</max-size>
</kernal>
</thread-pool>
<io-strategy>leader-follower</io-strategy>
</rexpro>
<shutdown-port>8183</shutdown-port>
<shutdown-host>127.0.0.1</shutdown-host>
<config-check-interval>10000</config-check-interval>
<script-engines>
<script-engine>
<name>gremlin-groovy</name>
<reset-threshold>-1</reset-threshold>
<init-scripts>config/init.groovy</init-scripts>
<imports>com.tinkerpop.rexster.client.*</imports>
<static-imports>java.lang.Math.PI</static-imports>
</script-engine>
</script-engines>
<security>
<authentication>
<type>none</type>
<configuration>
<users>
<user>
<username>rexster</username>
<password>rexster</password>
</user>
</users>
</configuration>
</authentication>
</security>
<metrics>
<reporter>
<type>jmx</type>
</reporter>
<reporter>
<type>http</type>
</reporter>
<reporter>
<type>console</type>
<properties>
<rates-time-unit>SECONDS</rates-time-unit>
<duration-time-unit>SECONDS</duration-time-unit>
<report-period>10</report-period>
<report-time-unit>MINUTES</report-time-unit>
<includes>http.rest.*</includes>
<excludes>http.rest.*.delete</excludes>
</properties>
</reporter>
</metrics>
<graphs>
<graph>
<graph-name>graph</graph-name>
<graph-type>com.thinkaurelius.titan.tinkerpop.rexster.TitanGraphConfiguration</graph-type>
<graph-location></graph-location>
<graph-read-only>false</graph-read-only>
<properties>
<storage.backend>cassandrathrift</storage.backend>
<storage.hostname>127.0.0.1</storage.hostname>
</properties>
<extensions>
<allows>
<allow>tp:gremlin</allow>
</allows>
</extensions>
</graph>
</graphs>
</rexster>
Perhaps there is just some confusion in Rexster's role. Your question was:
My issue is that when I instantiate an TitanGraph using the TitanFactory as seen below there does not seem to be the option to specify the graph name?
Note that using TitanFactory
will open a TitanGraph
instance that connects directly to cassandra. That has nothing to do with Rexster. If you want to connect to Rexster (which remotely holds a TitanGraph
instance given your configuration) then you must do so through REST or RexPro. With the more simple approach for verifying operations being REST, try to curl:
curl http://localhost:8182/graphs
That should return some JSON that contains the name of the TitanGraph
instance you configured in the <graph-name>
field in rexster.xml
. The <graph-name>
simply identifies the graph instance in Rexster so that you can uniquely identify it in requests when there are multiple instances hosted in there.