Has anyone been able to connect to AWS MCS using a java client? Following their docs I have supplied -Djavax.net.ssl.trustStore and -Djavax.net.ssl.trustStorePassword to the JVM on my local machine but I just get the following error:
"Could not reach any contact point"
I am able to use the same details to connect via cqlsh. the AWS docs for the Java client seem a little light on detail.
The last thing I tried looked like this :
InetSocketAddress address1 = new InetSocketAddress("cassandra.xx-xxxx-x.amazonaws.com", 9142);
return CqlSession.builder()
.withLocalDatacenter("xx-xxxx-x")
.addContactPoint(address1)
.withAuthCredentials("amc_connection-at-xyz", "xxxxxxxxxx")
.withKeyspace("xxxxxxxx")
.build();
Suspect i need to supply an SslContext but not sure how to configure one for this, the actual exception thrown is DriverTimeoutException
It appears you can add an SSL context by adding the following to your builder:
.withSslContext(SSLContext.getDefault())
As an example:
CqlSession.builder()
.addContactPoints(contactPoints)
.withSslContext(SSLContext.getDefault())
.withLocalDatacenter("us-east-2")
.withAuthProvider(new SigV4AuthProvider("us-east-2"))
.build());
There appears to be a more detailed document here:
https://docs.aws.amazon.com/mcs/latest/devguide/ManagedCassandraService.pdf
Specifically - page 16
Hope this helps
您需要调用 withSSL() 才能使用系统属性https://docs.datastax.com/en/developer/java-driver/3.1/manual/ssl/#driver-configuration 。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.