Я использую Cassandra Cluster, который имеет три экземпляра на 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 показывает, что все три узла являются UN и проблем нет.- Мы попытались подключить Cassandra через консоль (./cqlsh), которая также не работала, пока мы не перезапустили сервисы.
Версия 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