I've a simple crud based application in which Apache Cassandra is used as the default database. I've used Spring Data Cassandra for the Cassandra connectivity.
Now, I'm trying to move into AWS Keyspace which which is well supported with the Cassandra java driver. I've followed this doc for the configuration.
However, I'm always getting the following exception whenever I'm starting the app.
Caused by: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: cassandra.us-east-2.amazonaws.com/<ip>:9142 (com.datastax.driver.core.exceptions.OperationTimedOutException: [cassandra.us-east-2.amazonaws.com/<ip>:9142] Operation timed out))
I've used added following props in the application.properties:
spring.data.cassandra.contact-points=cassandra.us-east-2.amazonaws.com
spring.data.cassandra.port=9142
spring.data.cassandra.cluster-name=<name>
spring.data.cassandra.username=<username>
spring.data.cassandra.password=<password>
I've also tried using application.conf by adding the props:
datastax-java-driver {
basic.contact-points = [ "cassandra.us-east-2.amazonaws.com:9142"]
advanced.auth-provider{
class = PlainTextAuthProvider
username = "<username>"
password = "<password>"
}
basic.load-balancing-policy {
local-datacenter = "us-east-2"
}
advanced.ssl-engine-factory {
class = DefaultSslEngineFactory
truststore-path = "/home/centos/keyspaces/cassandra_truststore.jks"
truststore-password = "<password>"
}
}
But still same result. Note that the trustStore config is added as jvm argumets as well:
javax.net.ssl.trustStore=/home/centos/keyspaces/cassandra_truststore.jks
javax.net.ssl.trustStorePassword=<password>
Strange thing is that, from the same machine I can telnet to this Keyspace host-port and even can directly connect to that instance using below command:
conda activate python2
export SSL_CERTFILE="/home/centos/keyspaces/sf-class2-root.crt"
cqlsh cassandra.us-east-2.amazonaws.com 9142 -u <username> -p <password> --ssl