即使无法满足​​一致性,Cassandra 是否会写入节点(已启动)? [英] Does Cassandra write to a node(which is up) even if Consistency cannot be met?

查看:22
本文介绍了即使无法满足​​一致性,Cassandra 是否会写入节点(已启动)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Cassandra 文档中的以下声明是我怀疑的原因.

The below statement from Cassandra documentation is the reason for my doubt.

例如,如果使用复制因子为 3 的 QUORUM 写入一致性级别,Cassandra 会将写入复制到集群中的所有节点,并等待来自两个节点的确认.如果写入在其中一个节点上失败但在另一个节点上成功,Cassandra 会报告在该节点上复制写入失败.但是,在其他节点上成功的复制写入不会自动回滚.

For example, if using a write consistency level of QUORUM with a replication factor of 3, Cassandra will replicate the write to all nodes in the cluster and wait for acknowledgement from two nodes. If the write fails on one of the nodes but succeeds on the other, Cassandra reports a failure to replicate the write on that node. However, the replicated write that succeeds on the other node is not automatically rolled back.

参考:http://docs.datastax.com/en/cassandra/2.1/cassandra/dml/dml_atomicity_c.html

那么即使无法满足​​一致性,Cassandra 是否也会写入节点(已启动)?

So does Cassandra write to a node(which is up) even if Consistency cannot be met ?

推荐答案

我明白了.如果 Cassandra 知道无法满足一致性,它甚至不会尝试写入.如果可以满足一致性,但没有足够的副本来满足复制因子,那么 Cassandra 将写入当前可用的副本并给出成功消息.稍后当副本再次启动时,它将写入其他副本.

I got it. Cassandra will not even attempt to write if it knows that consistency cannot be met. If consistency CAN be met, but does not have enough replicas to satisfy replication factor, then Cassandra would write to currently available replicas and gives a success message. Later when the replica is up again, it will write to other replica.

例如如果复制因子为 3 ,则 3 个节点中有 1 个已关闭,那么如果我以 2 的一致性写入,则写入将成功.但是,如果复制因子为 2 并且 2 个节点中有 1 个已关闭,那么如果我以 2 的一致性写入,Cassandra 甚至不会写入可用的单个节点.

For e.g. If Replication factor is 3 , 1 of 3 nodes are down, then if I write with a Consistency of 2, the write will succeed. But if Replication factor is 2 and 1 of 2 nodes are down , then if I write with a Consistency of 2, Cassandra will not even write to that single node which is available.

文档中提到的是在可以满足一致性的情况下启动写入的情况.但中间有一个节点宕机,无法完成写入,而另一节点写入成功.由于无法满足一致性,客户端将收到失败消息.写入单个节点的记录稍后将在节点修复或压缩期间删除.

What is mentioned in the documentation is a case where while write was initiated when the consistency can be met. But in between, one node went down and couldn't complete the write, whereas write succeeded in other node. Since consistency cannot be met, client would get a failure message. The record which was written to a single node would be removed later during node repair or compaction.

这篇关于即使无法满足​​一致性,Cassandra 是否会写入节点(已启动)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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