在Cassandra上处理quorum wrires失败 [英] Handling quorum writies fail on Cassandra

查看:251
本文介绍了在Cassandra上处理quorum wrires失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据Datastax关于Cassandra中原子性的文档:QUORUM写成功只在一个节点上不会回滚(检查原子性章节有: http://www.datastax.com/documentation/cassandra/1.2/webhelp/index.html#cassandra/dml/dml_about_transactions_c.html )。因此,当我在RF = 3并且一个节点失败的集群上执行QUORUM写入时,我将在另一个节点上获得写入错误状态和一个成功写入。这产生两种情况:

According to Datastax documentation about atomicity in Cassandra: QUORUM write succeeded only on one node will not be rolled back (Check Atomicity chapter there:http://www.datastax.com/documentation/cassandra/1.2/webhelp/index.html#cassandra/dml/dml_about_transactions_c.html). So when I am performing a QUORUM write on cluster with RF=3 and one node fails, I will get write error status and one successful write on another node. This produces two cases:


  1. 写入将在其他节点上线时传播;

  2. 如果节点接受该写入将在传播之前完全中断,写入可以完全丢失。

什么是处理这种

推荐答案

当QUORUM写入失败并出现TimedOut异常时,不知道写操作是否成功。您应该重试写入,并将其视为失败。如果您有多个写入需要分组在一起,则应将它们放在批处理中,以便批处理成功或一起失败。

When a QUORUM write fails with a "TimedOut" exception, you don't know if the write succeeded or not. You should retry the write, and treat it as if it failed. If you have multiple writes that you need to be grouped together, you should place them in a "batch", so that the batch succeeds or fails together.

,你也想做QUORUM读取,如果你关心一致的结果回来。如果你有一个RF = 3,并且QUORUM只写在一个节点上,第一次QUORUM读取成功,包括新的值,它将被修复在其他节点之一,QUORUM读将总是给新的值。因此,即使该值写在ONE,连续的QUORUM读取永远不会看到该值回到时间。

In either case, you also want to be doing QUORUM reads if you care about consistent results coming back. If you had an RF=3, and the QUORUM write only got on one node, the first time a QUORUM read succeeds that includes the new value, it will be repaired on one of the other nodes, and QUORUM read will always give the new value. So even if the value is written at ONE, successive QUORUM reads will never see the value go back in time.

这篇关于在Cassandra上处理quorum wrires失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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