2016-05-10 4 views
1

私はcassandra 2.0.9を使用していますが、最近2.0.5からdatastax javaドライババージョン3.0.0に移行しました。私は、ドライバ3.0.0における任意の接続に問題がある例外がドライバ3.0.0データストアドライバ3.0でNoHostAvailableExceptionが頻繁に発生する

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))) 
    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) 

に移動した後に頻繁に発生し、次のしています。 cassandraクラスタを接続するコードは

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; 
    } 

誰でも手助けできますか?

答えて

0

複数の同時リクエストシーンで1つのクラスタと1つまたは少数のセッションインスタンスを使用します。

+0

実際に私は1つのクラスタと1つのセッションインスタンスだけを使用してクエリしています。それが私のために起こっても。 –

関連する問題