2012-07-22 2 views
6

astandanax를 사용하여 로컬 cassandra에 연결하려고하지만 지속적으로 PoolTimeoutException이 발생합니다. 나는 cli 또는 hector 클라이언트를 사용하여 cassandra에 연결할 수 있습니다. 내가 뭘 잘못하고 있는지 알 겠어?Astyanax를 통해 Cassandra에 연결할 때 PoolTimeoutException이 발생합니다.

감사합니다.

내 코드 :

val context = new AstyanaxContext.Builder() 
     .forCluster("cluster") 
     .forKeyspace(keyspace) 
     .withAstyanaxConfiguration(
       new AstyanaxConfigurationImpl() 
        .setDiscoveryType(NodeDiscoveryType.NONE) 
     ) 
     .withConnectionPoolConfiguration(
       new ConnectionPoolConfigurationImpl("ConnPool") 
        .setPort(9160) 
        .setMaxConnsPerHost(1) 
        .setMaxBlockedThreadsPerHost(1) 
        .setSeeds("127.0.0.1:9160") 
        .setConnectTimeout(10000) 
     ) 
     .withConnectionPoolMonitor(new CountingConnectionPoolMonitor()) 
     .buildKeyspace(ThriftFamilyFactory.getInstance()) 
    context.start() 
    return context.getEntity() 

예외 :

Exception in thread "main" java.lang.RuntimeException: com.netflix.astyanax.connectionpool.exceptions.PoolTimeoutException: PoolTimeoutException: [host=127.0.0.1(127.0.0.1):9160, latency=10004(10004), attempts=1] Timed out waiting for connection 
at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$7.getNextBlock(ThriftColumnFamilyQueryImpl.java:652) 
at com.netflix.astyanax.thrift.ThriftAllRowsImpl$1.hasNext(ThriftAllRowsImpl.java:61) 
at scala.collection.JavaConversions$JIteratorWrapper.hasNext(JavaConversions.scala:574) 
at scala.collection.Iterator$class.foreach(Iterator.scala:772) 
at scala.collection.JavaConversions$JIteratorWrapper.foreach(JavaConversions.scala:573) 
at scala.collection.IterableLike$class.foreach(IterableLike.scala:73) 
at scala.collection.JavaConversions$JIterableWrapper.foreach(JavaConversions.scala:587) 
at at scala.Function0$class.apply$mcV$sp(Function0.scala:34) 
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12) 
at scala.App$$anonfun$main$1.apply(App.scala:60) 
at scala.App$$anonfun$main$1.apply(App.scala:60) 
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59) 
at scala.collection.immutable.List.foreach(List.scala:76) 
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:30) 
at scala.App$class.main(App.scala:60) 
at Caused by: com.netflix.astyanax.connectionpool.exceptions.PoolTimeoutException: PoolTimeoutException: [host=127.0.0.1(127.0.0.1):9160, latency=10004(10004), attempts=1] Timed out waiting for connection 
at com.netflix.astyanax.connectionpool.impl.SimpleHostConnectionPool.waitForConnection(SimpleHostConnectionPool.java:201) 
at com.netflix.astyanax.connectionpool.impl.SimpleHostConnectionPool.borrowConnection(SimpleHostConnectionPool.java:158) 
at com.netflix.astyanax.connectionpool.impl.RoundRobinExecuteWithFailover.borrowConnection(RoundRobinExecuteWithFailover.java:60) 
at com.netflix.astyanax.connectionpool.impl.AbstractExecuteWithFailoverImpl.tryOperation(AbstractExecuteWithFailoverImpl.java:50) 
at com.netflix.astyanax.connectionpool.impl.AbstractHostPartitionConnectionPool.executeWithFailover(AbstractHostPartitionConnectionPool.java:229) 
at com.netflix.astyanax.thrift.ThriftColumnFamilyQueryImpl$7.getNextBlock(ThriftColumnFamilyQueryImpl.java:623) 

답변

2

우리는뿐만 아니라이 문제가되었다. 우리에게는 libthrift의 버전 문제로 밝혀졌습니다. 버전 0.7.0이 효과가있었습니다. 버전 0.6.1은 그렇지 않았습니다. 클래스 패스를 확인하고 ... 행운을 빈다.

당신이 하나 개의 노드에 데이터를 꽝하고 50의 스레드 및 호스트 당 1 개 연결을 사용하는 경우 또 다른 문제가

+0

true에 "톰 D"좋은 캐치, 감사를 확인하라! astyanax jar를 v1.0.6으로 업그레이드하는 사람은 libthrift를 0.7.0으로 업그레이드하는 것을 잊지 마십시오. –

2

을 -td 당신이 스레드의 수를 균형 그래서, 당신은 같은 일을 얻을 것이다/특정 상황에서도 호스트.

1

잘못된 포트를 통해 연결을 시도하면이 오류가 발생합니다. 자세한 내용은 this 토론을 참조하십시오.

0

해피

  1. rpc_address
  2. 검사에게 rpc_port
  3. 설정 start_rpc
관련 문제