簡體   English   中英

如何為cassandra設置讀取請求超時

[英]How to set read request timeout for cassandra

我嘗試為具有不同讀取請求超時的 cassandra 創建新端點。 大數據請求超時時間長的端點響應。 我找到了帶有 com.datastax.cassandra 驅動程序的 Scala 代碼和帶有 read_request_timeout 參數的 cassandra-default.yaml。 如何在 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();

套接字選項

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM