1

I'm trying to integrate my service with AWS Cassandra (Keyspaces) with the following config:

    cassandra:
      default:
        advanced:
          ssl: true
          ssl-engine-factory: DefaultSslEngineFactory
          metadata:
            schema:
              enabled: false
          auth-provider:
            class: PlainTextAuthProvider
            username: "XXXXXX"
            password: "XXXXXX"
        basic:
          contact-points:
            - ${CASSANDRA_HOST:"127.0.0.1"}:${CASSANDRA_PORT:"9042"}
          load-balancing-policy:
            local-datacenter: "${CASSANDRA_DATA_CENTER}:datacenter1"
          session-keyspace: "keyspace"

Whenever I'm running the service it fails to load with the following error:

Message: Could not reach any contact point, make sure you've provided valid addresses (showing first 1 nodes, use getAllErrors() for more): Node(endPoint=cassandra.eu-west-1.amazonaws.com/3.248.244.41:9142, hostId=null, hashCode=7296b27b): [com.datastax.oss.driver.api.core.DriverTimeoutException: [s0|control|id: 0x1f1c50a1, L:/172.17.0.3:54802 - R:cassandra.eu-west-1.amazonaws.com/3.248.244.41:9142] Protocol initialization request, step 1 (OPTIONS): timed out after 5000 ms]

There's very little documentation about the cassandra-micronaut library, so I'm not sure what I'm doing wrong here.

UPDATE:

For clarity: the values of our environment variables are as follow:

   export CASSANDRA_HOST=cassandra.eu-west-1.amazonaws.com
   export CASSANDRA_PORT=9142
   export CASSANDRA_DATA_CENTER=eu-west-1

Note that even when I've hard-coded the values into my application.yml the problem continued.

Yonatan Karp-Rudin
  • 1,056
  • 8
  • 24

2 Answers2

1

I think you need to adjust your variables in this example. The common syntax for Apache Cassandra or Amazon Keyspaces is host:port. For Amazon Keyspaces the port is always 9142.

Try the following:

contact-points:
 - ${CASSANDRA_HOST}:${CASSANDRA_PORT}

or simply hard code them at first.

contact-points:
 - cassandra.eu-west-1.amazonaws.com:9142
MikeJPR
  • 764
  • 3
  • 14
0

So this:

contact-points:
    - ${CASSANDRA_HOST:"127.0.0.1"}:${CASSANDRA_PORT:"9042"}

Doesn't match up with this:

Node(endPoint=cassandra.eu-west-1.amazonaws.com/3.248.244.41:9142,

Double-check which IP(s) and port Cassandra is broadcasting on (usually seen with nodetool status) and adjust the service to not look for it on 127.0.0.1.

Aaron
  • 55,518
  • 11
  • 116
  • 132
  • Hi @Aaron , as I'm using Keyspaces and not managing my own cluster I don't have access to `nodetool status` (as far as I know). I've updated the question with a bit more details – Yonatan Karp-Rudin Jun 08 '21 at 07:37