我试图处理Kafka流汇总结果插入Cassandra。但在500毫秒后的连接过程中,我遇到了低于超时的错误。为什么会出现这种情况?我如何增加此超时或是否可以关闭此查询?
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驱动程序配置:
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>
2条答案
按热度按时间whhtz7ly1#
如果您使用的是datastax kafka连接器,并且希望更改java驱动程序配置,那么可以将上面的内容添加到
connect-standalone.properties
文件(或任何你命名的文件)。命名空间配置为datastax-java-driver
.特别是,把这个加到我的
connect-standalone.properties
文件超时了:有关更多信息,请参阅官方文档。
但是,请记住,有时真正的问题不是超时时间太低,而是超时是另一个潜在问题的症状。有关这方面的讨论,请参见datastax社区。
yptwkmov2#
我相信你也需要加上这个,以避免超时
system.peers
:datastax-java-driver.advanced.control-connection.timeout=20000 milliseconds