卡桑德拉时间,因为TTL到期 [英] Cassandra Timing out because of TTL expiration

查看:180
本文介绍了卡桑德拉时间,因为TTL到期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即时通讯使用DataStax社区诉2.1.2-1(AMI v 2.5),preinstalled默认设置+增加阅读时间来这里10秒是问题

Im using a DataStax Community v 2.1.2-1 (AMI v 2.5) with preinstalled default settings+ increased read time out to 10sec here is the issue

 create table simplenotification_ttl (
               user_id varchar, 
               real_time timestamp,
               insert_time timeuuid,
               read boolean,
               msg varchar, PRIMARY KEY (user_id, real_time, insert_time));

插入查询:

insert into simplenotification_ttl (user_id, real_time, insert_time, read) 
  values ('test_3',14401440123, now(),false) using TTL 800;

有关相同的test_3我插的 33000 元组。 [此问题不会发生24,000元组的]

For same 'test_3' I inserted 33,000 tuples. [This problem does not happen for 24,000 tuples]

渐渐地,我看

cqlsh:notificationstore> select count(*)  from simplenotification_ttl where user_id = 'test_3'; 

 count
-------
 15681

(1 rows)

cqlsh:notificationstore> select count(*)  from simplenotification_ttl where user_id = 'test_3'; 

 count
-------
 12737

(1 rows)

cqlsh:notificationstore> select count(*)  from simplenotification_ttl where user_id = 'test_3'; 
**errors={}, last_host=127.0.0.1**

我甚至在不同的表尝试了很多次。一旦发生这种情况,即使我插入与同USER_ID和做限制1.超时检索。

I have experimented this many times even on different tables. Once this happens, even if i insert with same user_id and do a retrieval with limit 1. It times out.

我需要TTL正常工作,即给予数0推测后的时间。如何解决这个问题? 谢谢

I require TTL to work properly ie give count 0 after speculated time. How to solve this issue? Thanks

[我的另一个节点相关的设置使用m3.large在2个节点EC2Snitch]

[My other node related setup is using m3.large with 2 nodes EC2Snitch]

推荐答案

您正在运行到一个问题,即墓碑的数目(删除值)是通过一个阈值,然后超时。

You're running into a problem where the number of tombstones (deleted values) is passing a threshold, and then timing out.

您可以看到这一点,如果你开启跟踪,然后尝试你的SELECT语句,例如:

You can see this if you turn on tracing and then try your select statement, for example:

cqlsh> tracing on;
cqlsh> select count(*) from test.simple;

 activity                                                                        | timestamp    | source       | source_elapsed
---------------------------------------------------------------------------------+--------------+--------------+----------------
...snip...
 Scanned over 100000 tombstones; query aborted (see tombstone_failure_threshold) | 23:36:59,324 |  172.31.0.85 |         123932
                                                    Scanned 1 rows and matched 1 | 23:36:59,325 |  172.31.0.85 |         124575
                           Timed out; received 0 of 1 responses for range 2 of 4 | 23:37:09,200 | 172.31.13.33 |       10002216

您正在种运行到那里数据被删除之前存储的短短一年时间反模式的卡桑德拉。有几个选项来处理这更好的,包括如果需要重新访问您的数据模型。这里有一些资源:

You're kind of running into an anti-pattern for Cassandra where data is stored for just a short time before being deleted. There are a few options for handling this better, including revisiting your data model if needed. Here are some resources:

  • The cassandra.yaml configuration file - See section on tombstone settings
  • Cassandra anti-patterns: Queues and queue-like datasets
  • About deletes

有关样品的问题,我试图降低 gc_grace_seconds 设置为300(5分钟)。这使得墓碑被清理的更频繁地比默认的10天,但根据您的应用程序可能或不恰当的。阅读上删除的影响,您可以根据需要为您的应用程序进行调整。

For your sample problem, I tried lowering the gc_grace_seconds setting to 300 (5 minutes). That causes the tombstones to be cleaned up more frequently than the default 10 days, but that may or not be appropriate based on your application. Read up on the implications of deletes and you can adjust as needed for your application.

这篇关于卡桑德拉时间,因为TTL到期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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