• Glossary
  • Support
  • Downloads
  • DataStax Home
Get Live Help
Expand All
Collapse All

DataStax Astra DB Classic Documentation

    • Overview
      • Release notes
      • Astra DB FAQs
      • Astra DB glossary
      • Get support
    • Getting Started
      • Grant a user access
      • Load and retrieve data
        • Use DSBulk to load data
        • Use Data Loader in Astra Portal
      • Connect a driver
      • Build sample apps
      • Use integrations
        • Connect with DataGrip
        • Connect with DBSchema
        • Connect with JanusGraph
        • Connect with Strapi
    • Planning
      • Plan options
      • Database regions
    • Securing
      • Security highlights
      • Security guidelines
      • Default user permissions
      • Change your password
      • Reset your password
      • Authentication and Authorization
      • Astra DB Plugin for HashiCorp Vault
    • Connecting
      • Connecting to a VPC
      • Connecting Change Data Capture (CDC)
      • Connecting CQL console
      • Connect the Spark Cassandra Connector to Astra
      • Drivers for Astra DB
        • Connecting C++ driver
        • Connecting C# driver
        • Connecting Java driver
        • Connecting Node.js driver
        • Connecting Python driver
        • Drivers retry policies
      • Connecting Legacy drivers
      • Get Secure Connect Bundle
    • Migrating
      • FAQs
      • Preliminary steps
        • Feasibility checks
        • Deployment and infrastructure considerations
        • Create target environment for migration
        • Understand rollback options
      • Phase 1: Deploy ZDM Proxy and connect client applications
        • Set up the ZDM Automation with ZDM Utility
        • Deploy the ZDM Proxy and monitoring
          • Configure Transport Layer Security
        • Connect client applications to ZDM Proxy
        • Manage your ZDM Proxy instances
      • Phase 2: Migrate and validate data
      • Phase 3: Enable asynchronous dual reads
      • Phase 4: Change read routing to Target
      • Phase 5: Connect client applications directly to Target
      • Troubleshooting
        • Troubleshooting tips
        • Troubleshooting scenarios
      • Additional resources
        • Glossary
        • Contribution guidelines
        • Release Notes
    • Managing
      • Managing your organization
        • User permissions
        • Pricing and billing
        • Audit Logs
        • Configuring SSO
          • Configure SSO for Microsoft Azure AD
          • Configure SSO for Okta
          • Configure SSO for OneLogin
      • Managing your database
        • Create your database
        • View your databases
        • Database statuses
        • Use DSBulk to load data
        • Use Data Loader in Astra Portal
        • Monitor your databases
        • Manage multiple keyspaces
        • Using multiple regions
        • Terminate your database
        • Resize your classic database
        • Park your classic database
        • Unpark your classic database
      • Managing with DevOps API
        • Managing database lifecycle
        • Managing roles
        • Managing users
        • Managing tokens
        • Managing multiple regions
        • Get private endpoints
        • AWS PrivateLink
        • Azure PrivateLink
        • GCP Private Service
    • Astra CLI
    • Developing with Stargate APIs
      • Develop with REST
      • Develop with Document
      • Develop with GraphQL
        • Develop with GraphQL (CQL-first)
        • Develop with GraphQL (Schema-first)
      • Develop with gRPC
        • gRPC Rust client
        • gRPC Go client
        • gRPC Node.js client
        • gRPC Java client
      • Develop with CQL
      • Tooling Resources
      • Node.js Document API client
      • Node.js REST API client
    • Stargate QuickStarts
      • Document API QuickStart
      • REST API QuickStart
      • GraphQL API CQL-first QuickStart
    • API References
      • DevOps REST API v2
      • Stargate Document API v2
      • Stargate REST API v2
  • DataStax Astra DB Classic Documentation
  • Getting Started
  • Use integrations
  • Connect with JanusGraph

Configure JanusGraph with Astra DB as storage backend

Use DataStax Astra DB as the storage backend for JanusGraph server.

JanusGraph uses the Java driver to connect to Apache Cassandra®. The Java driver supports the use of the secure connect bundle to connect to Astra DB, but JanusGraph does not provide this functionality. Thus it’s necessary to unpack the secure connect bundle and use its contents to configure JanusGraph.

Prerequisites

This article assumes you have a running installation of JanusGraph server. These steps were written and tested on JanusGraph v0.6.0.

You will also need to:

  1. Generate an application token for your Astra DB.

  2. Download the secure connect bundle for your Astra DB.

Prepare your secure bundle

  1. On the JanusGraph server, unpack your secure bundle.

    • Example commands

    • Example file listing

    $ cd /path/to/scb
    $ unzip secure-connect-graphdb.zip
    /
      path/
        to/
          scb/
            ca.crt
            cert
            cert.pfx
            config.json
            cqlshrc
            identity.jks
            key
            trustStore.jks
  2. Extract your database metadata from the config.json file.

    • Example config.json

    {
      "host": "70bf8560-105f-11ec-a3ea-0800200c9a66-us-west1.db.astra.datastax.com",
      "port": 98765,
      "cql_port": 34567,
      "keyspace": "graphks",
      "localDC": "us-west1",
      "caCertLocation": "./ca.crt",
      "keyLocation": "./key",
      "certLocation": "./cert",
      "keyStoreLocation": "./identity.jks",
      "keyStorePassword": "Kga1OJ83EF2oBQYR5",
      "trustStoreLocation": "./trustStore.jks",
      "trustStorePassword": "n8F9ptJO3H7YRxTW1",
      "csvLocation": "./data",
      "pfxCertPassword": "9b3HgFChtY60m4nfJ"
    }

Configure JanusGraph

  1. On the JanusGraph server, modify the CQL storage configuration file janusgraph-cql.properties. Make the necessary changes using the example template below.

    • Example commands

    • Example template

    $ cd /path/to/installation/janusgraph-0.6.0
    $ vi conf/janusgraph-cql.properties
    # basic CQL settings
    gremlin.graph=org.janusgraph.core.JanusGraphFactory
    storage.backend=cql
    storage.hostname=CONFIG-JSON-HOST
    storage.port=CONFIG-JSON-CQL-PORT
    storage.username=token               <----- literally the string "token"
    storage.password=ASTRA_APP_TOKEN
    storage.cql.keyspace=GRAPH_KEYSPACE
    storage.cql.local-datacenter=CONFIG-JSON-LOCALDC
    
    # SSL related settings
    storage.cql.ssl.enabled=true
    storage.cql.ssl.truststore.location=/path/to/scb/trustStore.jks
    storage.cql.ssl.truststore.password=CONFIG-JSON-TRUSTSTOREPASSWORD
    storage.cql.ssl.keystore.location=/path/to/scb/identity.jks
    storage.cql.ssl.keystore.keypassword=CONFIG-JSON-KEYSTOREPASSWORD
    storage.cql.ssl.keystore.storepassword=CONFIG-JSON-KEYSTOREPASSWORD
    storage.cql.ssl.client-authentication-enabled=true
    
    # consistency settings
    storage.cql.read-consistency-level=LOCAL_QUORUM
    storage.cql.write-consistency-level=LOCAL_QUORUM
    The username to connect to Astra is literally the word "token". Do not set this value to your DB’s client ID.
    The ASTRA_APP_TOKEN is from the token you generated in the Prerequisites section above.
  2. Using the example values in the config.json above, the conf/janusgraph-cql.properties would contain:

    • Example config.json

    # basic CQL settings
    gremlin.graph=org.janusgraph.core.JanusGraphFactory
    storage.backend=cql
    storage.hostname=70bf8560-105f-11ec-a3ea-0800200c9a66-us-west1.db.astra.datastax.com
    storage.port=34567
    storage.username=token
    storage.password=AstraCS:AbCwZYOKqvXHZWRvpbvHqXYz:47820923e5be3b7b9e689bc18614c631d5fdd8b435e68613433651fd20fexyz0
    storage.cql.keyspace=graphks
    storage.cql.local-datacenter=us-west1
    
    # SSL related settings
    storage.cql.ssl.enabled=true
    storage.cql.ssl.truststore.location=/path/to/scb/trustStore.jks
    storage.cql.ssl.truststore.password=n8F9ptJO3H7YRxTW1
    storage.cql.ssl.keystore.location=/path/to/scb/identity.jks
    storage.cql.ssl.keystore.keypassword=Kga1OJ83EF2oBQYR5
    storage.cql.ssl.keystore.storepassword=Kga1OJ83EF2oBQYR5
    storage.cql.ssl.client-authentication-enabled=true
    
    # consistency settings
    storage.cql.read-consistency-level=LOCAL_QUORUM
    storage.cql.write-consistency-level=LOCAL_QUORUM

Final test

  1. Start a Gremlin console.

    • Command

    $ bin/gremlin.sh
     
             \,,,/
             (o o)
    -----oOOo-(3)-oOOo-----
    gremlin>
  2. Load a graph using Astra as the storage backend with:

    • Command

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

    Note that it is normal to see some warnings on the Gremlin console. See this file with a sample output for comparison of what to expect.

  3. In the Astra DB CQL Console, check that the JanusGraph tables were successfully created:

    • Example

    token@cqlsh> USE graphks;
    token@cqlsh:graphks> DESCRIBE TABLES;
    
    edgestore_lock_  graphindex_lock_         janusgraph_ids
    txlog            systemlog                graphindex
    edgestore        system_properties_lock_  system_properties
Connect with DBSchema Connect with Strapi

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

© DataStax | Privacy policy | Terms of use

DataStax, Titan, and TitanDB are registered trademarks of DataStax, Inc. and its subsidiaries in the United States and/or other countries.

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.

landing_page landingpage