java - Cassandra 在一致性 LOCAL_ONE 读取查询期间失败(需要 1 个响应,但只有 0 个副本响应,1 个失败)

标签 java cassandra cassandra-3.0

下面是我的脚本

CREATE TABLE alrashed.tbl_alerts_details (
    alert_id int,
    action_required int,
    alert_agent_id int,
    alert_agent_type_id int,
    alert_agent_type_name text,
    alert_definer_desc text,
    alert_definer_name text,
    alert_source text,
    alert_state text,
    col_1 text,
    col_2 text,
    col_3 text,
    col_4 text,
    col_5 text,
    current_escalation_level text,
    date_part date,
    device_id text,
    driver map<text, text>,
    is_processed int,
    is_real_time int,
    location map<text, text>,
    seq_no int,
    severity text,
    time_stamp timestamp,
    transporter map<text, text>,
    transporter_name text,
    trip_id int,
    updated_on timestamp,
    vehicle map<text, text>,
    vehicle_type_name text,
    PRIMARY KEY (alert_id)
    ) WITH read_repair_chance = 0.0
    AND dclocal_read_repair_chance = 0.1
    AND gc_grace_seconds = 864000
    AND bloom_filter_fp_chance = 0.01
    AND caching = { 'keys' : 'ALL', 'rows_per_partition' : 'NONE' }
    AND comment = ''
    AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold' : 32, 'min_threshold' : 4 }
    AND compression = { 'chunk_length_in_kb' : 64, 'class' : 'org.apache.cassandra.io.compress.LZ4Compressor' }
    AND default_time_to_live = 0
    AND speculative_retry = '99PERCENTILE'
    AND min_index_interval = 128
    AND max_index_interval = 2048
    AND crc_check_chance = 1.0;  

当我运行这个查询时,我得到了

Cassandra failure during read query at consistency LOCAL_ONE (1 responses were required but only 0 replica responded, 1 failed) error

这是我在 Java 中的 cassandra 查询:

select
  count( * )
from
  tbl_alerts_details
where
  alert_state = 'ACKNOWLEDGE'
  and date_part >= '2017-10-01'
  and date_part <= '2017-10-31'
  and is_real_time = 1
  and alert_agent_type_name = 'VEHICLE' ALLOW FILTERING

最佳答案

这个错误让我们意识到我们的空间问题,在每一行中以 Base64 格式存储图像很快就会出现 Tombstone 问题。

根据这个post ,

Cassandra doesn't just scan through the rows, but also has to accumulate them in memory while it prepares the response. This can cause an out-of-memory error on the node if things go too far out, and if multiple nodes are servicing the request, it may even cause a multiple failure bringing down the whole cluster. To prevent this from happening, the service aborts the query if it detects a dangerous number of tombstones.

关于java - Cassandra 在一致性 LOCAL_ONE 读取查询期间失败(需要 1 个响应,但只有 0 个副本响应,1 个失败),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47069563/

相关文章:

java - Java 中的电子邮件服务抛出 "out of memory"错误

java - maven 程序集 - jar 错过了自己的类(class)

apache-spark - 如何有效地使用spark读取具有分区热点的cassandra数据?

timeout - cassandra 中的 read_request_timeout_in_ms

Cassandra 高可用性

Cassandra:删除带有静态列的最后一条记录

java - 实际和形式参数列表的长度不同,但它们实际上是相同的

java - 'File.delete()' 的结果被忽略

java - Cassandra新手关于集群的问题

java - cassandra3.0中触发器的实现