Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

com.datastax.oss.driver.api.core.DriverTimeoutException: query 'SELECT * FROM system.peers' timed out after PT0.5S

Tags:

I am trying to process inserts Kafka Streams aggregation results to Cassandra. But I am getting below timeout error during connection after 500ms. Why this occur and how can I increase this timeout or is it possible to turn off this query?

Caused by: com.datastax.oss.driver.api.core.DriverTimeoutException: query 'SELECT * FROM system.peers' timed out after PT0.5S
    at com.datastax.oss.driver.api.core.DriverTimeoutException.copy(DriverTimeoutException.java:34)
    at com.datastax.oss.driver.internal.core.util.concurrent.CompletableFutures.getUninterruptibly(CompletableFutures.java:149)
    at com.datastax.oss.driver.api.core.session.SessionBuilder.build(SessionBuilder.java:612)
    at aggregator.sink.CassandraSink.connect(CassandraSink.java:94)
    at aggregator.sink.CassandraSink.init(CassandraSink.java:62)
    at aggregator.sink.CassandraSink_ClientProxy.init(CassandraSink_ClientProxy.zig:253)
    at org.apache.kafka.streams.processor.internals.ProcessorNode.lambda$init$0(ProcessorNode.java:97)
    at org.apache.kafka.streams.processor.internals.metrics.StreamsMetricsImpl.maybeMeasureLatency(StreamsMetricsImpl.java:806)
    at org.apache.kafka.streams.processor.internals.ProcessorNode.init(ProcessorNode.java:94)

datastax-java-driver config:

datastax-java-driver.basic.contact-points.0=10.0.111.61:9042
datastax-java-driver.basic.load-balancing-policy.local-datacenter=datacenter1
datastax-java-driver.basic.session-keyspace=my_ks
datastax-java-driver.basic.request.timeout=20 seconds
datastax-java-driver.advanced.auth-provider.class=PlainTextAuthProvider
datastax-java-driver.advanced.auth-provider.username=${CASSANDRA_USR}
datastax-java-driver.advanced.auth-provider.password=${CASSANDRA_PWD}
datastax-java-driver.advanced.protocol.version=V4
datastax-java-driver.advanced.timestamp-generator.force-java-clock=true
datastax-java-driver.advanced.connection.init-query-timeout=10000 milliseconds
datastax-java-driver.advanced.connection.pool.remote.size=10
datastax-java-driver.advanced.connection.pool.local.size=5
datastax-java-driver.advanced.heartbeat.timeout=2000 milliseconds
<dependency>
  <groupId>com.datastax.oss</groupId>
  <artifactId>java-driver-core</artifactId>
  <version>4.5.0</version>
</dependency>

<dependency>
  <groupId>com.datastax.oss</groupId>
  <artifactId>java-driver-query-builder</artifactId>
  <version>4.5.0</version>
</dependency>
like image 411
nikli Avatar asked Jun 16 '20 13:06

nikli


2 Answers

If you are using Datastax Kafka Connector, and want to change java driver configs, you add what you have above into your connect-standalone.properties file (or whatever you have it named). Namespace configs with datastax-java-driver.

In particular, adding this to my connect-standalone.properties file got the timeout working for me:

datastax-java-driver.advanced.connection.init-query-timeout=2000 milliseconds

For more information, see the official documentation.

However, keep in mind that sometimes the real problem is not that the timeout is too low, but instead the fact that you are timing out is a symptom of a different underlying issue. See here at Datastax community for one discussion related to this.

like image 105
RyanQuey Avatar answered Oct 11 '22 15:10

RyanQuey


I believe you need to add this one as well, to avoid timeouts on system.peers:

datastax-java-driver.advanced.control-connection.timeout=20000 milliseconds

like image 40
navrang Avatar answered Oct 11 '22 16:10

navrang