I know there are several threads about the NoHostAvailableException
but they simply don't provide a solution to my problem.
I can't connect to Cassandra with the Datastax Java Cassandra Driver. I get the Error:
com.datastax.driver.core.exceptions.NoHostAvailableException: All
host(s) tried for query failed (tried: [/54.221.241.107])
I am sure that the configuration is correct. I've set the configuration in cassandra.yaml:
start_native_transport: true
# port for the CQL native transport to listen for clients on
native_transport_port: 9042
My Cassandra installation is a standard installation on a EC2 instance on AWS. I've configured AWS to allow port 9042.
Cassandra is running on Windows Server 2008 R2 and I also configured the firewall to inbound and outbound connection on 9042.
My code looks like the following:
cluster = Cluster.builder()
.withPort(9042)
.addContactPoint("54.221.241.107").build();
I don't know what to do anymore since I always get this error. Any suggestions?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…