I am not able to do queries against the Cassandra Node. I am able to make the connection to the cluster and connect. However while doing the the query, it fails
Caused by: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (no host was tried)
at com.datastax.driver.core.RequestHandler.reportNoMoreHosts(RequestHandler.java:217)
at com.datastax.driver.core.RequestHandler.access$1000(RequestHandler.java:44)
at com.datastax.driver.core.RequestHandler$SpeculativeExecution.sendRequest(RequestHandler.java:276)
at com.datastax.driver.core.RequestHandler.startNewExecution(RequestHandler.java:117)
at com.datastax.driver.core.RequestHandler.sendRequest(RequestHandler.java:93)
at com.datastax.driver.core.SessionManager.executeAsync(SessionManager.java:127)
... 3 more
This is how I am connecting to the cluster:
List<String> servers = config.getCassandraServers();
Builder builder = Cluster.builder();
for (String server : servers) {
builder.addContactPoints(server);
}
PoolingOptions opts = new PoolingOptions();
opts.setCoreConnectionsPerHost(HostDistance.LOCAL, opts.getCoreConnectionsPerHost(HostDistance.LOCAL));
// setup socket exceptions
SocketOptions socketOpts = new SocketOptions();
socketOpts.setReceiveBufferSize(1048576);
socketOpts.setSendBufferSize(1048576);
socketOpts.setTcpNoDelay(false);
cluster = builder.withSocketOptions(socketOpts)
.withRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE)
.withPoolingOptions(opts)
.withReconnectionPolicy(new ConstantReconnectionPolicy(100L))
.withLoadBalancingPolicy(new DCAwareRoundRobinPolicy(getColo(config)))
.build();
cluster.connect();
I am using latest stable version of Cassandra 2.2.3 with the Datastax driver:
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>2.1.8</version>
</dependency>
Any pointers are highly appreciated
Thanks Masti