Integrate JanusGraph and Astra DB Serverless

query_builder 15 min

JanusGraph supports graph traversals and analytical queries on extremely large graphs. Your Astra DB Serverless databases can be the storage backend for JanusGraph.

Prepare Astra

  1. Create an Astra DB Serverless database or use an existing one.

  2. Generate an application token with the Database Administrator role.

  3. Download your database’s Secure Connect Bundle (SCB).

  4. Create a keyspace in your database where JanusGraph will store the graph. There is no required name for this keyspace; you specify the keyspace name in your JanusGraph configuration.

Configure JanusGraph

  1. Deploy and start a JanusGraph instance if you don’t already have one.

  2. Store your database’s SCB zip file in a location where it can be accessed by your JanusGraph deployment.

    JanusGraph uses the Apache Cassandra® Java driver to connect to Astra, which requires access to the SCB. If you are running JanusGraph locally, you can store the SCB zip file anywhere on your local filesystem. If you are running JanusGraph as a container or remote deployment, choose an appropriate location based on your deployment infrastructure.

  3. Set the Astra connection parameters in your JanusGraph CQL storage configuration file (conf/janusgraph-cql.properties). You can set the properties directly, with a JVM argument, or use an external configuration file.

    • Direct string configuration

    • JVM argument configuration

    • External file configuration

    janusgraph-cql.properties
    gremlin.graph=org.janusgraph.core.JanusGraphFactory
    storage.backend=cql
    storage.cql.keyspace=KEYSPACE
    storage.username=token
    storage.password=APPLICATION_TOKEN
    storage.cql.internal.string-configuration=datastax-java-driver { basic.cloud.secure-connect-bundle=PATH/TO/SCB.zip }

    Replace the following:

    • KEYSPACE: The name of the keyspace you created for JanusGraph in Astra.

    • APPLICATION_TOKEN: A secure reference to your Astra application token (prefixed by AstraCS:).

    • PATH/TO/SCB.zip: The path to your database’s SCB zip file.

    1. Set the following in your janusgraph-cql.properties file:

      gremlin.graph=org.janusgraph.core.JanusGraphFactory
      storage.backend=cql
      storage.cql.keyspace=KEYSPACE
      storage.username=token
      storage.password=APPLICATION_TOKEN

      Replace the following:

      • KEYSPACE: The name of the keyspace you created for JanusGraph in Astra.

      • APPLICATION_TOKEN: A secure reference to your Astra application token (prefixed by AstraCS:).

    2. When starting JanusGraph, use a JVM argument to pass the driver configuration with the path to your database’s SCB:

      -Ddatastax-java-driver.basic.cloud.secure-connect-bundle=PATH/TO/SCB.zip

    Use this option if you want to separate the Java driver configuration for Astra from the rest of your JanusGraph configuration.

    1. Create a .conf file that contains the Java driver configuration:

      astra.conf
      datastax-java-driver {
        basic.cloud {
          secure-connect-bundle = "PATH/TO/SCB.zip"
        }
        advanced.auth-provider {
          class = PlainTextAuthProvider
          username = "token"
          password = "APPLICATION_TOKEN"
        }
      }

      Replace the following:

      • KEYSPACE: The name of the keyspace you created for JanusGraph in Astra.

      • APPLICATION_TOKEN: A secure reference to your Astra application token (prefixed by AstraCS:).

      • PATH/TO/SCB.zip: The path to your database’s SCB zip file.

    2. In your janusgraph-cql.properties file, set your JanusGraph keyspace and the path to your external configuration file:

      janusgraph-cql.properties
      gremlin.graph=org.janusgraph.core.JanusGraphFactory
      storage.backend=cql
      storage.cql.keyspace=KEYSPACE
      storage.cql.internal.file-configuration=PATH/TO/ASTRA.conf

The storage.cql.internal properties configure the Apache Cassandra Java driver used by JanusGraph to connect to Astra. You can pass any supported Java driver configuration value. For more complex configurations, consider using the external file configuration approach, rather than passing the entire configuration as a single string or JVM argument. For more information about driver configuration, see DataStax-compatible Cassandra drivers.

Test the JanusGraph integration

  1. Start a Gremlin console:

    bin/gremlin.sh
  2. Load a graph using Astra as the storage backend:

    gremlin> graph = JanusGraphFactory.open('conf/janusgraph-cql.properties')
    ==>standardjanusgraph[cql:[70bf8560-105f-11ec-a3ea-0800200c9a66-us-west1.db.astra.datastax.com]]

    Some warnings are normal and can be ignored.

  3. Use cqlsh to check that the JanusGraph tables are present in Astra:

    DESCRIBE KEYSPACE_NAME;

    Replace KEYSPACE_NAME with the name of your JanusGraph keyspace.

    Result
    edgestore_lock_  graphindex_lock_         janusgraph_ids
    txlog            systemlog                graphindex
    edgestore        system_properties_lock_  system_properties

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2025 DataStax, an IBM Company | Privacy policy | Terms of use | Manage Privacy Choices

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com