Cassandra 节点丢失

Cassandra loss of a node

我想弄清楚,如何为我的 2 节点集群设置参数,以便在其中一个节点出现故障时获得精确的副本... 使用此工具进行检查:http://www.ecyrd.com/cassandracalculator/

对于以下参数:

Cluster size: 2 / Replication Factor: 2 / Write Level: All / Read Level: One

它给了我结果:

我同意所有结果,除了一个 "You can survive the loss of no nodes"。 我不明白为什么集群无法从一个节点丢失中幸存下来,如果一个节点死亡,"Write: ALL" 将写入仅剩下的一个节点,不是吗? 然后当我恢复第二个节点时,它应该与第一个节点同步,并再次接受写入,不是吗?

如果我错了,有人可以向我解释为什么吗?

编辑:

更多配置会给我相同的结果,除了持有百分比:

Cluster size: 3 / Replication Factor: 2 / Write Level: All / Read Level: One
Cluster size: 3 / Replication Factor: 2 / Write Level: Quorum / Read Level: One

即使我尝试与读取保持一致,而不是与写入保持一致:

Cluster size: 2 / Replication Factor: 2 / Write Level: One / Read Level: Quorum

每次都告诉我不能在任何节点上吃亏

那是因为复制因素

When replication factor exceeds the number of nodes, writes are rejected, but reads are served as long as the desired consistency level can be met.

来源:http://www.datastax.com/docs/1.0/cluster_architecture/replication

I agree with all those result except one, "You can survive the loss of no nodes". I don't get why the cluster can't survive from one node loss, if one dies, the "Write: ALL" will write to the only one node left, doesn't it ? Then when I bring back up the second node, it should synchronize with the 1st, and accept writes again, doesn't it ?

If I'm wrong, can someone explain to me why ?

这不是一致性的工作原理。当一个节点出现故障时,Cassandra 在计算 QUORUM 时不会忘记它。您的复制因子是 2,因此 ALL 是 2,一旦一个节点关闭,您就无法写入。

如果您需要读取一致性(请务必这样做)。然后尝试 RF 为 3 的 3 节点集群,然后以 QUORUM 读写。这意味着您现在可以处理一个节点以进行读取和写入。

最后一个例子:

Cluster size: 2 / Replication Factor: 2 / Write Level: One / Read Level: Quorum

QUORUM = RF / 2 + 1 = 2 所以你情绪低落的原因是什么。

通常您需要 QUORUM 系统的奇数 RF。