如何为cassandra设置读取请求超时
How to set read request timeout for cassandra
我尝试为具有不同读取请求超时的 cassandra 创建新端点。大数据请求超时时间长的端点响应。
我发现 Scala 代码带有 com.datastax.cassandra 驱动程序和 cassandra-default.yaml 带有 read_request_timeout 参数。如何在 Cluster builder 或代码中的其他地方设置 read_request_timeout?
Cluster
.builder
.addContactPoints(cassandraHost.split(","): _*)
.withPort(cassandraPort)
.withRetryPolicy(DefaultRetryPolicy.INSTANCE)
.withLoadBalancingPolicy(
new TokenAwarePolicy(DCAwareRoundRobinPolicy.builder().build())).build
# How long the coordinator should wait for read operations to complete
read_request_timeout_in_ms: 5000
在查询级别设置使用:
session.execute(
new SimpleStatement("CQL HERE").setReadTimeoutMillis(65000));
如果要在集群构建时设置,请使用:
Cluster cluster = Cluster.builder()
.addContactPoint("127.0.0.1")
.withSocketOptions(
new SocketOptions()
.setConnectTimeoutMillis(2000))
.build();
我尝试为具有不同读取请求超时的 cassandra 创建新端点。大数据请求超时时间长的端点响应。 我发现 Scala 代码带有 com.datastax.cassandra 驱动程序和 cassandra-default.yaml 带有 read_request_timeout 参数。如何在 Cluster builder 或代码中的其他地方设置 read_request_timeout?
Cluster
.builder
.addContactPoints(cassandraHost.split(","): _*)
.withPort(cassandraPort)
.withRetryPolicy(DefaultRetryPolicy.INSTANCE)
.withLoadBalancingPolicy(
new TokenAwarePolicy(DCAwareRoundRobinPolicy.builder().build())).build
# How long the coordinator should wait for read operations to complete
read_request_timeout_in_ms: 5000
在查询级别设置使用:
session.execute(
new SimpleStatement("CQL HERE").setReadTimeoutMillis(65000));
如果要在集群构建时设置,请使用:
Cluster cluster = Cluster.builder()
.addContactPoint("127.0.0.1")
.withSocketOptions(
new SocketOptions()
.setConnectTimeoutMillis(2000))
.build();