cassandra-3.0docker-containerjanusgraphjava-17gremlin-server

How To Setup JanusGraph Cassandra On Docker


Problem

With Docker containers, how do setup Apache Cassandra to work with Docker?
I need to setup an external JanusGraph to handle tens of millions of records.
I'm new to Cassandra, JanusGraph, and Graph-Databases in-general.

Repo Steps

  1. Download-and-Install Docker [Program]
  2. Create-and-Startup JanusGraph [Docker-container]
    docker run -d -p 8182:8182 janusgraph/janusgraph
    
  3. Create-and-Startup Apache Cassandra [Docker-container]
    docker run --name jg-cassandra -d -e CASSANDRA_START_RPC=true -p 9160:9160 
       -p 9042:9042 -p 7199:7199 -p 7001:7001 -p 7000:7000 cassandra:3.11
    
  4. Code-and-Run test to connect to Cassandra container for JanusGraph instance
    JanusGraph janusGraph = JanusGraphFactory.build().set("storage.backend", "cql").set("storage.hostname", "localhost:9042").open();
    
  5. Results
    1. Expected: JanusGraphFactory-instance to connect to Cassandra-docker-container
    2. Actual: Error
java.lang.Throwable: Hook creation trace
    at org.janusgraph.graphdb.database.StandardJanusGraph.<init>(StandardJanusGraph.java:250) [janusgraph-core-1.0.0-20230424-065649.dcd3240.jar:?]
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:176) [janusgraph-core-1.0.0-20230424-065649.dcd3240.jar:?]
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:147) [janusgraph-core-1.0.0-20230424-065649.dcd3240.jar:?]
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:137) [janusgraph-core-1.0.0-20230424-065649.dcd3240.jar:?]
    at org.janusgraph.core.JanusGraphFactory$Builder.open(JanusGraphFactory.java:277) [janusgraph-core-1.0.0-20230424-065649.dcd3240.jar:?]
    at Main.main(Main.java:10) [classes/:?]
// Main
import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphFactory;

public class Main {
    public static void main(String[] args) {
        JanusGraph janusGraph = JanusGraphFactory.build().set("storage.backend", "cql").set("storage.hostname", "localhost:9042").open();
        janusGraph.close();
    }
}
<!-- pom.xml -->
    <dependencies>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j2-impl</artifactId>
            <version>2.20.0</version>
        </dependency>
        <dependency>
            <groupId>org.janusgraph</groupId>
            <artifactId>janusgraph-core</artifactId>
            <version>1.0.0-20230424-065649.dcd3240</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tinkerpop</groupId>
            <artifactId>gremlin-core</artifactId>
            <version>3.6.2</version>
        </dependency>
        <dependency>
            <groupId>org.janusgraph</groupId>
            <artifactId>janusgraph-cql</artifactId>
            <version>1.0.0-20230428-082704.5159135</version>
        </dependency>
    </dependencies>

Cassandra seems to have JanusGraph


Solution

  • That stack trace is for debugging purposes and is not an error. See StandardTitanGraph java.lang.Throwable: Hook creation trace error