我使用的是一个cassandra集群,它在aws上有三个示例。超过100个微服务同时访问cassandra,每个微服务都有自己的键空间和连接。经过一段时间后,这些服务都不能访问cassandra并抛出异常
Do we need to enable Pooling option for Cassandra connectivity?
Is there any issue option to get rid off this issue while creating a Cluster in java code.
What is the maximum number of connection can be used?
在我重新启动所有的微服务后,它开始正常工作。但过了一段时间之后就开始发生了我们已经检查了堆的使用情况,gc似乎正常。-nodetool状态显示所有三个节点都未运行并且没有问题。-我们试图通过控制台(./cqlsh)连接cassandra,在重新启动服务之前,控制台也不起作用。
cassandra版本-apache-cassandra-3.11.2
We are using below jars for Cassandra drive for connection.
-cassandra-driver-core-3.6.0.jar</br>
-cassandra-driver-extras-3.6.0.jar</br>
-cassandra-driver-mapping-3.6.0.jar</br>
if (cluster == null || cluster.isClosed()) {
Builder builder = Cluster.builder()
.addContactPointsWithPorts(inetSocketAddress)
.withClusterName(clusterName)
.withReconnectionPolicy(new ConstantReconnectionPolicy(10000L));
cluster = builder.build();
cluster.getConfiguration().getSocketOptions()
.setReadTimeoutMillis(readTimeoutMillis);
cluster.getConfiguration().getSocketOptions()
.setConnectTimeoutMillis(connectionTimeoutMillis);
}
c.d.d.c.ControlConnection Test Cluster-reconnection-1 [ERROR] [Control connection] Cannot connect to any host, scheduling retry in 10000 milliseconds
c.d.d.c.ControlConnection Test Cluster-reconnection-0 [ERROR] [Control connection] Cannot connect to any host, scheduling retry in 10000 milliseconds
2019-05-14 20:53:27.877 c.d.d.c.ControlConnection Test Cluster-worker-63522 [ERROR] [Control connection] Unexpected error while refreshing schema
java.util.concurrent.ExecutionException: com.datastax.driver.core.exceptions.OperationTimedOutException: [/localhost:9042] Operation timed out
at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:476) ~[guava-19.0.jar:?]
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:455) ~[guava-19.0.jar:?]
at com.datastax.driver.core.SchemaParser.get(SchemaParser.java:672) ~[cassandra-driver-core-3.6.0.jar:?]
at com.datastax.driver.core.SchemaParser.access$500(SchemaParser.java:41) ~[cassandra-driver-core-3.6.0.jar:?]
at com.datastax.driver.core.SchemaParser$V3SchemaParser.fetchSystemRows(SchemaParser.java:925) ~[cassandra-driver-core-3.6.0.jar:?]
at com.datastax.driver.core.SchemaParser.refresh(SchemaParser.java:87) ~[cassandra-driver-core-3.6.0.jar:?]
at com.datastax.driver.core.ControlConnection.refreshSchema(ControlConnection.java:408) ~[cassandra-driver-core-3.6.0.jar:?]
at com.datastax.driver.core.ControlConnection.refreshSchema(ControlConnection.java:354) [cassandra-driver-core-3.6.0.jar:?]
at com.datastax.driver.core.Cluster$Manager$SchemaRefreshRequestDeliveryCallback$1.runMayThrow(Cluster.java:2867) [cassandra-driver-core-3.6.0.jar:?]
at com.datastax.driver.core.ExceptionCatchingRunnable.run(ExceptionCatchingRunnable.java:32) [cassandra-driver-core-3.6.0.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_202]
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:108) [guava-19.0.jar:?]
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:41) [guava-19.0.jar:?]
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:77) [guava-19.0.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_202]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_202]
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138) [netty-all-4.0.53.Final.jar:4.0.53.Final]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_202]
Caused by: com.datastax.driver.core.exceptions.OperationTimedOutException: [/localhost:9042] Operation timed out
at com.datastax.driver.core.DefaultResultSetFuture.onTimeout(DefaultResultSetFuture.java:257) ~[cassandra-driver-core-3.6.0.jar:?]
at com.datastax.driver.core.Connection$ResponseHandler$1.run(Connection.java:1575) ~[cassandra-driver-core-3.6.0.jar:?]
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:663) ~[netty-all-4.0.53.Final.jar:4.0.53.Final]
at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:738) ~[netty-all-4.0.53.Final.jar:4.0.53.Final]
at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:466) ~[netty-all-4.0.53.Final.jar:4.0.53.Final]
... 2 more
暂无答案!
目前还没有任何答案,快来回答吧!