cassandra中的读取错误 [英] Reading error in cassandra
问题描述
我在尝试从 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!
这篇关于cassandra中的读取错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!