简体   繁体   English

处理Cassandra的最终一致性

[英]Dealing with eventual consistency in Cassandra

I have a 3 node cassandra cluster with RF=2. 我有一个3节点的cassandra集群,RF = 2。 The read consistency level, call it CL, is set to 1. 读取一致性级别(称为CL)设置为1。

I understand that whenever CL=1,a read repair would happen when a read is performed against Cassandra, if it returns inconsistent data. 我知道只要CL = 1,当对Cassandra执行读取时,如果它返回不一致的数据,就会发生读取修复。 I like the idea of having CL=1 instead of setting it to 2, because then even if a node goes down, my system would run fine. 我喜欢让CL = 1而不是将它设置为2的想法,因为那时即使节点发生故障,我的系统也能正常运行。 Thinking by the way of the CAP theorem, I like my system to be AP instead of CP. 通过CAP定理的方式思考,我喜欢我的系统是AP而不是CP。 The read requests are seldom(more like 2-3 per second), but are very important to the business. 读取请求很少(更像是每秒2-3次),但对业务非常重要。 They are performed against log-like data(which is immutable, and hence never updated). 它们是针对类似日志的数据执行的(这是不可变的,因此永远不会更新)。 My temporary fix for this is to run the query more than once, say 3 times, instead of running it once. 我对此的临时修复是多次运行查询,比如运行3次,而不是运行一次。 This way, I can be sure that that even if I don't get my data in the first read request, the system would trigger read repairs, and I would eventually get my data during the 2nd or 3rd read request. 这样,我可以肯定,即使我没有在第一个读取请求中获取数据,系统也会触发读取修复,我最终会在第二次或第三次读取请求期间获取数据。 Ofcourse, these 3 queries happen one after the other, without any blocking. 当然,这三个查询一个接一个地发生,没有任何阻塞。

Is there any way that I can direct Cassandra to perform read repairs in the background without having the need to actually perform a read request in order to trigger a repair? 有没有什么方法可以指示Cassandra在后台执行读取修复而无需实际执行读取请求以触发修复? Basically, I am looking for ways to tune my system in a way as to circumvent the 'eventual consistency' model, by which my reads would have a high probability of succeeding. 基本上,我正在寻找方法来调整我的系统,以避开“最终一致性”模型,通过该模型,我的读取将很有可能成功。

Help would be greatly appreciated. 非常感谢帮助。

reads would have a high probability of succeeding 读取很有可能成功

Look at DowngradingConsistencyRetryPolicy this policy allows retry queries with lower CL than the initial one. 查看DowngradingConsistencyRetryPolicy此策略允许以低于初始CL的CL重试查询。 With this policy your queries will have strong consistency when all nodes are available and you will not lose availability if some node is fail. 使用此策略,当所有节点都可用时,您的查询将具有很强的一致性,如果某个节点发生故障,您将不会失去可用性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 最终在Cassandra中的一致性是什么意思? - Meaning of eventual consistency in Cassandra? Apache OFBiz与Cassandra的集成以及最终的一致性 - Apache OFBiz integration with Cassandra and Eventual Consistency 处理分布式数据存储的最终一致性的应用程序的简单示例? - Simple examples of application dealing with eventual-consistency of distributed datastore? Cassandra如何保证跨区域复制的最终一致性? - How does Cassandra guarantee eventual consistency in cross region replication? 如何减慢cassandra以暴露最终的一致性问题 - How to slow down cassandra to expose eventual consistency issues RDBMS(Oracle)的最终一致性 - Eventual consistency in RDBMS (Oracle) 如果在 gc.grace.seconds 期间没有读取该数据,Cassandra 是否会在没有手动修复的情况下达到最终一致性? - Will Cassandra reach eventual consistency without manual repair if there is no read for that data during gc.grace.seconds? 最终的一致性-如何避免幻影 - Eventual consistency - how to avoid phantoms 在最终的一致性环境中写入后读取记录 - Read record after write in eventual consistency environment 解释Merkle树用于最终一致性 - Explain Merkle Trees for use in Eventual Consistency
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM