【问题标题】:read time out in cassandra in django cassandra engine在 django cassandra 引擎中的 cassandra 中读取超时
【发布时间】:2019-07-28 01:07:32
【问题描述】:

您好,我在 python 中使用 cassandra。我在 cassandra 中有一个表,其中 line_id (uuid) 作为它的主键。我有大约 2000000 条记录(每个分区有一条记录)。当我想获取记录数时:

NumberPartitionedLine.objects.count()

我得到这个错误:

Error from server: code=1200 [Coordinator node timed out waiting for replica nodes' responses] message="Operation timed out - received only 0 responses." info={'consistency': 'LOCAL_ONE', 'received_responses': 0, 'required_responses': 1}

当我在 razorsqldatagrip 中运行查询 select count(*) from number_partitioned_line 时, 我收到超时错误并且无法获得结果。 什么原因?

【问题讨论】:

  • 您需要增加分配给 Cassandra DB 服务器的内存。

标签: python cassandra cql cqlengine razorsql


【解决方案1】:

您正试图从 200 万个分区中读取数据,这在 Cassandra 中确实不推荐。

如果不受分区键限制,则执行 count(*) 将对节点施加很大压力,并且在您的情况下,您不能按分区限制,因为每个分区只有一条记录。

在你的情况下最好使用柜台 - https://docs.datastax.com/en/cql/3.3/cql/cql_using/useCountersConcept.html

您可以在 yaml 等中调整内存分配或增加超时,但这只会有助于将问题推到以后。

【讨论】:

    猜你喜欢
    • 2014-08-06
    • 2014-07-02
    • 2019-08-14
    • 2016-11-26
    • 2014-03-03
    • 2013-07-09
    • 1970-01-01
    • 2014-05-20
    • 2015-08-25
    相关资源
    最近更新 更多