Skip to content

Instantly share code, notes, and snippets.

@phact
Created July 1, 2020 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phact/72d555dc248494faa8d91312a9cb753f to your computer and use it in GitHub Desktop.
Save phact/72d555dc248494faa8d91312a9cb753f to your computer and use it in GitHub Desktop.

application.conf

# Configuration for akka-persistence-cassandra
akka.persistence.cassandra {
  events-by-tag {
    bucket-size = "Day"
    # for reduced latency
    eventual-consistency-delay = 200ms
    flush-interval = 50ms
    pubsub-notification = on
    first-time-bucket = "20200115T00:00"
  }

  query {
    refresh-interval = 2s
  }

  # don't use autocreate in production
  journal.keyspace-autocreate = off
  journal.tables-autocreate = on
  snapshot.keyspace-autocreate = off
  snapshot.tables-autocreate = on
  journal.keyspace = "<ASTRA_KEYSPACE>"
  snapshot.keyspace = "<ASTRA_KEYSPACE>"
}

datastax-java-driver {
  advanced.reconnect-on-init = on
  basic.contact-points = [ "<ASTRA_DNS>:<ASTRA_CQL_PORT>" ]
  basic.load-balancing-policy.local-datacenter = caas-dc
  local-datacenter = caas-dc
  advanced.ssl-engine-factory {
    class = DefaultSslEngineFactory


    hostname-validation = false

    truststore-path = ./<PATH_TO_UNZIPPED_SCB>/trustStore.jks
    truststore-password = <TRUSTSTORE_PASSWORD>
    keystore-path = ./<PATH_TO_UNZIPPED_SCB>/identity.jks
    keystore-password = <KEYSTORE_PASSWORD>
  }

  advanced.auth-provider {
    class = PlainTextAuthProvider
    username = <ASTRA_C*_DB_USERNAME>
    password = <ASTRA_C*DB_PASSWORD>
  }

}

akka.projection.cassandra.offset-store.keyspace = "<ASTRA_KEYSPACE>"

First, download your secure-connect-bundle from the Astra UI and unzip it in a directory in the host where you are running akka-persistence-cassandra.

Next, take a look at config.json and cqlshrc. You can pull the fields in <> in the config above from these two files:

$ cat scb/config.json 
{
  "host": "<ASTRA_DNS>",
  "port": <ASTRA_METADATA_PORT_THIS_IS_NOT_THE_CQL_PORT>,
  "keyspace": "<ASTRA_KEYSPACE>",
  "localDC": "caas-dc",
  "caCertLocation": "./ca.crt",
  "keyLocation": "./key",
  "certLocation": "./cert",
  "keyStoreLocation": "./identity.jks",
  "keyStorePassword": "<ASTRA_KEYSTORE_PASSWORD>",
  "trustStoreLocation": "./trustStore.jks",
  "trustStorePassword": "<ASTRA_TRUSTSTORE_PASSWORD>",
  "csvLocation": "./data",
  "pfxCertPassword": "Lkl08BhEVq2e4bw6m"
}
$ cat scb/cqlshrc 
[connection]
hostname = <ASTRA_DNS>
port = <ASTRA_CQL_PORT>
ssl = true

[ssl]
validate = true
certfile = ./ca.crt
userkey = ./key
usercert = ./cert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment