Cassandra loss of a node

对着背影说爱祢 提交于 2019-12-10 15:48:40

问题


I'm trying to figure out, how to parameter my 2 nodes cluster, in order to have an exact replica, if one of them is down... using this tools to check it out : http://www.ecyrd.com/cassandracalculator/

For the following parameters :

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

it gives me the results :

  • Your reads are consistent
  • You can survive the loss of no nodes.
  • You are really reading from 1 node every time.
  • You are really writing to 2 nodes every time.
  • Each node holds 100% of your data.

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 ?

EDIT :

More Configuration will give me the same results except for the holding %:

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

Even if I try to be consistent with Reads, and not Writes :

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

Every time it tells me that I can't suffer the loss on any node.


回答1:


That is because of the replication factor

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.

Source : http://www.datastax.com/docs/1.0/cluster_architecture/replication




回答2:


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 ?

This isn't how consistency works. When a node goes down Cassandra doesn't forget about it when working out QUORUM. Your replication factor is 2 and thus ALL is 2 and as soon as one node is down you are down for writes.

If you need read consistency (be sure that you do). Then try a 3 node cluster with a RF of 3 then read and write at QUORUM. This means you can now handle a node down for reads and writes.

For you last example:

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

QUORUM = RF / 2 + 1 = 2 so what is why you are down.

In general you want an odd RF for QUORUM systems.



来源:https://stackoverflow.com/questions/28192495/cassandra-loss-of-a-node

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!