com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /192.168.250.151:9042 (com.datastax.driver.core.exceptions.TransportException: [/192.168.250.151] Connection has been closed), /192.168.249.134:9042 (com.datastax.driver.core.exceptions.OperationTimedOutException: [/192.168.249.134] Timed out waiting for server response), /192.168.250.165:9042 (com.datastax.driver.core.exceptions.TransportException: [/192.168.250.165] Connection has been closed), /192.168.249.91:9042, /192.168.251.84:9042 [only showing errors of first 3 hosts, use getErrors() for more details])

DataStax JIRA | Rishikesan | 7 months ago
  1. 0

    i am using cassandra 2.0.9 and datastax java driver 3.0.0. I had too many NoHostAvailableException after some ReadTimeOutException and WriteTimeOutException.NoHostException occurred even though cassandra is normal and listening in 9160 and 9042 ports. It says some connections are closed, if connections are closed then it should establish new connections for processing. i haven't set connectionsPerHost. My code to connect cassandra using driver {code:java} private static Cluster constructCluster(String hostName,String port) { String[] hostNames = hostName.split(","); SocketOptions sOptions = new SocketOptions(); sOptions.setKeepAlive(true); QueryOptions qOptions = new QueryOptions().setConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM) .setFetchSize(500); LatencyAwarePolicy loadBalancingPolicy = LatencyAwarePolicy.builder(DCAwareRoundRobinPolicy.builder().withLocalDc(defaultDC).build()) .build(); Cluster cluster = Cluster.builder() .addContactPoints(hostNames) .withLoadBalancingPolicy(loadBalancingPolicy) .withPoolingOptions(new PoolingOptions()) .withQueryOptions(qOptions) .withReconnectionPolicy(new ConstantReconnectionPolicy(TimeUnit.SECONDS.toMillis(5))) .withRetryPolicy(new LoggingRetryPolicy(DefaultRetryPolicy.INSTANCE)) .withSocketOptions(sOptions) .build(); LOGGER.log(Level.SEVERE, "host name {0}", hostName); return cluster; } {code} My exception trace {code:java} com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /192.168.250.151:9042 (com.datastax.driver.core.exceptions.TransportException: [/192.168.250.151] Connection has been closed), /192.168.249.134:9042 (com.datastax.driver.core.exceptions.OperationTimedOutException: [/192.168.249.134] Timed out waiting for server response), /192.168.250.165:9042 (com.datastax.driver.core.exceptions.TransportException: [/192.168.250.165] Connection has been closed), /192.168.249.91:9042, /192.168.251.84:9042 [only showing errors of first 3 hosts, use getErrors() for more details]) at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:84) at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:37) at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37) at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245) at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:63) {code} another exception trace {code:java} com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /192.168.249.134:9042 (com.datastax.driver.core.exceptions.OperationTimedOutException: [/192.168.249.134] Timed out waiting for server response), /192.168.251.84:9042 (com.datastax.driver.core.exceptions.DriverException: Timeout while trying to acquire available connection (you may want to increase the driver number of per-host connections)), /192.168.250.151:9042 (com.datastax.driver.core.exceptions.TransportException: [/192.168.250.151] Connection has been closed), /192.168.250.165:9042, /192.168.249.91:9042 [only showing errors of first 3 hosts, use getErrors() for more details]) at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:84) at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:37) at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37) at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245) at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:63) {code} I cannot reproduce this issue later.

    DataStax JIRA | 7 months ago | Rishikesan
    com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /192.168.250.151:9042 (com.datastax.driver.core.exceptions.TransportException: [/192.168.250.151] Connection has been closed), /192.168.249.134:9042 (com.datastax.driver.core.exceptions.OperationTimedOutException: [/192.168.249.134] Timed out waiting for server response), /192.168.250.165:9042 (com.datastax.driver.core.exceptions.TransportException: [/192.168.250.165] Connection has been closed), /192.168.249.91:9042, /192.168.251.84:9042 [only showing errors of first 3 hosts, use getErrors() for more details])
  2. 0

    i am using cassandra 2.0.9 and datastax java driver 3.0.0. I had too many NoHostAvailableException after some ReadTimeOutException and WriteTimeOutException.NoHostException occurred even though cassandra is normal and listening in 9160 and 9042 ports. It says some connections are closed, if connections are closed then it should establish new connections for processing. i haven't set connectionsPerHost. My code to connect cassandra using driver {code:java} private static Cluster constructCluster(String hostName,String port) { String[] hostNames = hostName.split(","); SocketOptions sOptions = new SocketOptions(); sOptions.setKeepAlive(true); QueryOptions qOptions = new QueryOptions().setConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM) .setFetchSize(500); LatencyAwarePolicy loadBalancingPolicy = LatencyAwarePolicy.builder(DCAwareRoundRobinPolicy.builder().withLocalDc(defaultDC).build()) .build(); Cluster cluster = Cluster.builder() .addContactPoints(hostNames) .withLoadBalancingPolicy(loadBalancingPolicy) .withPoolingOptions(new PoolingOptions()) .withQueryOptions(qOptions) .withReconnectionPolicy(new ConstantReconnectionPolicy(TimeUnit.SECONDS.toMillis(5))) .withRetryPolicy(new LoggingRetryPolicy(DefaultRetryPolicy.INSTANCE)) .withSocketOptions(sOptions) .build(); LOGGER.log(Level.SEVERE, "host name {0}", hostName); return cluster; } {code} My exception trace {code:java} com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /192.168.250.151:9042 (com.datastax.driver.core.exceptions.TransportException: [/192.168.250.151] Connection has been closed), /192.168.249.134:9042 (com.datastax.driver.core.exceptions.OperationTimedOutException: [/192.168.249.134] Timed out waiting for server response), /192.168.250.165:9042 (com.datastax.driver.core.exceptions.TransportException: [/192.168.250.165] Connection has been closed), /192.168.249.91:9042, /192.168.251.84:9042 [only showing errors of first 3 hosts, use getErrors() for more details]) at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:84) at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:37) at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37) at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245) at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:63) {code} another exception trace {code:java} com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /192.168.249.134:9042 (com.datastax.driver.core.exceptions.OperationTimedOutException: [/192.168.249.134] Timed out waiting for server response), /192.168.251.84:9042 (com.datastax.driver.core.exceptions.DriverException: Timeout while trying to acquire available connection (you may want to increase the driver number of per-host connections)), /192.168.250.151:9042 (com.datastax.driver.core.exceptions.TransportException: [/192.168.250.151] Connection has been closed), /192.168.250.165:9042, /192.168.249.91:9042 [only showing errors of first 3 hosts, use getErrors() for more details]) at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:84) at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:37) at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37) at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245) at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:63) {code} I cannot reproduce this issue later.

    DataStax JIRA | 7 months ago | Rishikesan
    com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /192.168.250.151:9042 (com.datastax.driver.core.exceptions.TransportException: [/192.168.250.151] Connection has been closed), /192.168.249.134:9042 (com.datastax.driver.core.exceptions.OperationTimedOutException: [/192.168.249.134] Timed out waiting for server response), /192.168.250.165:9042 (com.datastax.driver.core.exceptions.TransportException: [/192.168.250.165] Connection has been closed), /192.168.249.91:9042, /192.168.251.84:9042 [only showing errors of first 3 hosts, use getErrors() for more details])
  3. 0

    NoHostAvailableException frequently occurs in datastax driver 3.0

    Stack Overflow | 7 months ago | Rishikesan Varadharajan
    com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/127.0.0.1:9042 (com.datastax.driver.core.exceptions.DriverException: Timeout while trying to acquire available connection (you may want to increase the driver number of per-host connections)))
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Need help getting spark-cassandra-connector to work

    Stack Overflow | 2 years ago
    com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (no host was tried)
  6. 0

    Spring Data CassandraTemplate insert throws exception but writes anyway

    Stack Overflow | 1 year ago | BPS
    com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (no host was tried)

    5 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.datastax.driver.core.exceptions.NoHostAvailableException

      All host(s) tried for query failed (tried: /192.168.250.151:9042 (com.datastax.driver.core.exceptions.TransportException: [/192.168.250.151] Connection has been closed), /192.168.249.134:9042 (com.datastax.driver.core.exceptions.OperationTimedOutException: [/192.168.249.134] Timed out waiting for server response), /192.168.250.165:9042 (com.datastax.driver.core.exceptions.TransportException: [/192.168.250.165] Connection has been closed), /192.168.249.91:9042, /192.168.251.84:9042 [only showing errors of first 3 hosts, use getErrors() for more details])

      at com.datastax.driver.core.exceptions.NoHostAvailableException.copy()
    2. DataStax Java Driver for Apache Cassandra - Core
      AbstractSession.execute
      1. com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:84)
      2. com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:37)
      3. com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37)
      4. com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245)
      5. com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:63)
      5 frames