user2524707 user2524707 - 14 days ago 5
Linux Question

Cassandra, Titan, Fatal configuration error

I tried starting titan with cassandra (linux):

TitanFactory.Builder config = TitanFactory.build();

config.set("storage.backend", "embeddedcassandra");
config.set("storage.directory", DIRECTORY);
config.set("index." + INDEX_NAME + ".backend", "elasticsearch");
config.set("index." + INDEX_NAME + ".DIRECTORY", DIRECTORY + File.separator + "es");
config.set("index." + INDEX_NAME + ".elasticsearch.local-mode", true);
config.set("index." + INDEX_NAME + ".elasticsearch.client-only", false);

graph = config.open();


Getting the following log:


09:57:50.195 [main] ERROR o.a.c.config.DatabaseDescriptor - Fatal
configuration error
org.apache.cassandra.exceptions.ConfigurationException: Expecting URI
in variable: [cassandra.config]. Please prefix the file with file:///
for local files or file:/// for remote files. Aborting. If you
are executing this from an external tool, it needs to set
Config.setClientMode(true) to avoid loading configuration. at
org.apache.cassandra.config.YamlConfigurationLoader.getStorageConfigURL(YamlConfigurationLoader.java:73)
~[cassandra-all-2.1.9.jar:2.1.9] at
org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:84)
~[cassandra-all-2.1.9.jar:2.1.9] at
org.apache.cassandra.config.DatabaseDescriptor.loadConfig(DatabaseDescriptor.java:161)
~[cassandra-all-2.1.9.jar:2.1.9] at
org.apache.cassandra.config.DatabaseDescriptor.(DatabaseDescriptor.java:136)
~[cassandra-all-2.1.9.jar:2.1.9] at
org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:164)
[cassandra-all-2.1.9.jar:2.1.9] at
org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:537)
[cassandra-all-2.1.9.jar:2.1.9] at
org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:626)
[cassandra-all-2.1.9.jar:2.1.9] at
com.thinkaurelius.titan.diskstorage.cassandra.utils.CassandraDaemonWrapper.start(CassandraDaemonWrapper.java:75)
[titan-cassandra-1.0.0.jar:na] at
com.thinkaurelius.titan.diskstorage.cassandra.embedded.CassandraEmbeddedStoreManager.(CassandraEmbeddedStoreManager.java:81)
[titan-cassandra-1.0.0.jar:na] at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[na:1.8.0_112] at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[na:1.8.0_112] at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[na:1.8.0_112] at
java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[na:1.8.0_112] at
com.thinkaurelius.titan.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:44)
[titan-core-1.0.0.jar:na] at
com.thinkaurelius.titan.diskstorage.Backend.getImplementationClass(Backend.java:473)
[titan-core-1.0.0.jar:na] at
com.thinkaurelius.titan.diskstorage.Backend.getStorageManager(Backend.java:407)
[titan-core-1.0.0.jar:na] at
com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.(GraphDatabaseConfiguration.java:1320)
[titan-core-1.0.0.jar:na] at
com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94)
[titan-core-1.0.0.jar:na] at
com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84)
[titan-core-1.0.0.jar:na] at
com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139)
[titan-core-1.0.0.jar:na] at
main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:68)
[main/:na] at
main.java.com.bag.server.TestServer.(TestServer.java:105)
[main/:na] at
main.java.com.bag.server.TestServer.main(TestServer.java:428)
[main/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) ~[na:1.8.0_112] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[na:1.8.0_112] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.8.0_112] at java.lang.reflect.Method.invoke(Method.java:498)
~[na:1.8.0_112] at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
[idea_rt.jar:na]

Answer

Embedded Cassandra requires you to specify where it can find its configuration file (cassandra.yaml). From the documentation:

When running Titan in embedded mode, the Cassandra yaml file is configured using the additional configuration option storage.conf-file, which specifies the yaml file as a full url, e.g. storage.conf-file = file:///home/cassandra.yaml.

Depending on what you are trying to achieve and as you are anyways not running fully in-memory (Elasticsearch) you might consider to use berkeleyje as your storage backend. Berkeley DB for Titan is essentially zero config. All you need is to do is specify the storage directory. E.g.

storage.backend=berkeleyje
storage.directory=${java.io.tmpdir}/${storage.dir}

Of course you are free to place the storage directory wherever you like.

Comments