卡桑德拉读取错误 [英] Reading error in cassandra

查看:90
本文介绍了卡桑德拉读取错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试从Cassandra表中读取数据时遇到堰式错误。我有一个默认安装的单节点安装。这是我正在执行的查询:

I'm having a weir error trying to read data from a Cassandra table. I have a single-node installation, with the default setup. This is the query I'm making:

  SELECT component_id,
         reading_1,
         reading_2,
         reading_3,
         date
  FROM component_readings
  WHERE park_id=2
        AND component_id IN (479)
        AND date >= '2016-04-09+0000'
        AND date <= '2016-05-08+0000';

component_readings 是一个简单的表,没有聚类条件:

component_readings is a simple table, with no clustering conditions:

CREATE TABLE component_readings (
    park_id int,
    component_id int,
    date timestamp,
    reading_1 decimal,
    reading_2 decimal,
    ...
    PRIMARY KEY ((park_id), component_id, date)
);

通过某些 component_id 值,它可以工作,并使用其他值,则失败。这是我得到的错误:

With some component_id values, it works, and with another values, it fails. This is the error I'm getting:

cassandra.ReadFailure: code=1300 [Replica(s) failed to execute read] 
message="Operation failed - received 0 responses and 1 failures"
info={'required_responses': 1, 'received_responses': 0, 'failures': 1,
'consistency': 'LOCAL_ONE'}

而cassandra的system.log显示此错误:

And the cassandra's system.log shows this error:

ERROR [SharedPool-Worker-1] 2016-05-09 15:33:58,872 StorageProxy.java:1818 - 
Scanned over 100001 tombstones during query 'SELECT * FROM xrem.component_readings
WHERE park_id, component_id = 2, 479 AND date >= 2016-04-09 02:00+0200 AND date <=
2016-05-08 02:00+0200 LIMIT 5000' (last scanned row partion key was ((2, 479),
2016-05-04 17:30+0200)); query aborted

奇怪的是,我仅在从外部程序进行查询时才得到错误(通过python cassandra-connector)。如果我直接在cqlsh shell中进行安装,则它可以正常工作。

The weird thing is that I get the error only when making the query from an external program (via the python cassandra-connector). If I make it directly in the cqlsh shell, it works perfectly.

我的安装是cassandra 2.2,但是我已经升级到3.5,并且遇到了同样的错误。

My installation was cassandra 2.2, but I've upgraded to 3.5, and I get the same error.

推荐答案

您超出了 tombstone_failure_threshold 。默认值为100'000。您可以

You are exceeding the tombstone_failure_threshold. It defaults to 100'000. You can either


  • 增加cassandra.yaml中的值,或者

  • 清理墓碑

要做后者更改表并将gc_grace_seconds设置为0:

To do the latter alter your table and set the gc_grace_seconds to 0:

ALTER TABLE component_readings WITH GC_GRACE_SECONDS = 0;

然后通过nodetool触发压缩。

Then trigger a compaction via the nodetool. This will flush out all tombstones.

在单节点群集的特定情况下,可以将GC_GRACE_SECONDS保留为零。但是,如果这样做,如果要使用多个节点,请记住撤消该操作!

In your particular scenario of a one-node-cluster you could leave the GC_GRACE_SECONDS at zero. But if you do, keep in mind to undo this if you ever want to use more than one node!

这篇关于卡桑德拉读取错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆