0

I try to create new endpoints for cassandra with different read request timeout. The endpoint with big timeout for requests with big data responds. I found Scala code with com.datastax.cassandra driver and cassandra-default.yaml with read_request_timeout parameter. How to set read_request_timeout in Cluster builder or in other places in code ?

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
undefined_variable
  • 6,180
  • 2
  • 22
  • 37
Vadim
  • 753
  • 8
  • 22

1 Answers1

2

Set at query level using :

session.execute(
        new SimpleStatement("CQL HERE").setReadTimeoutMillis(65000));

If you want to set while cluster bulding use :

Cluster cluster = Cluster.builder()
        .addContactPoint("127.0.0.1")
        .withSocketOptions(
                new SocketOptions()
                        .setConnectTimeoutMillis(2000))
        .build();

Socket Options

undefined_variable
  • 6,180
  • 2
  • 22
  • 37
  • Thanks, there is the .setReadTimeoutMillis instead .setConnectTimeoutMillis in second part of code. – Vadim Dec 02 '19 at 19:27