Varad
Varad

Reputation: 1022

Cassandra datastax gives error "All host(s) tried for query failed"

Today I encountered an issue while connecting to cassandra using datastax. I am got the error "All host(s) tried for query failed". Eventually I figured out that it was due to SSL termination the connectivity was not happening.

Question:

  1. I connected to cassandra from local client like Tableplus. I have given SSl as "Disabled" and I am still able to connect. Why is that I am not able to connect the same way while using the datastax driver.

My Nodetool status looks like this

Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address     Load       Tokens       Owns (effective)  Host ID                               Rack
UN  172.17.0.3  70.68 KiB  256          100.0%            cf65f26b-db8e-490b-bd38-ec8d74112b67  rack1

#
#

Upvotes: 4

Views: 1068

Answers (1)

Varad
Varad

Reputation: 1022

Thanks to both @Luciana for chiming in. But here the thing which worked for me eventually. Initially I did not have the empty clusterBuilder.withSSL();. But then later

Before

            Cluster.Builder clusterBuilder = Cluster.builder();
            if (sslEnabled) {
                clusterBuilder.withSSL(getSslOptions());
            }

After

            Cluster.Builder clusterBuilder = Cluster.builder();
            clusterBuilder.withSSL();
            if (sslEnabled) {
                clusterBuilder.withSSL(getSslOptions());
            }

I figured out with the Datastax documentation https://docs.datastax.com/en/developer/java-driver/3.0/manual/ssl/

and hope this helps. I don't claim this resolves all of the similar errors, but this can be one of the reasons that can resolve this connectivity issue.

Upvotes: 3

Related Questions