测试 Cassandras R + W > N

Test Cassandras R + W > N

我想在演示中明确显示 R + W > N 规则。

所以我最初的想法如下:

// setup
1: Create a Docker network with 3 Cassandra Nodes.  
2: Create a simple Keyspace with Replication-Factor of 3.  
3: Explicitly shutdown two of the docker nodes.

4: Create a write query inserting some data with W=1
   As two of the nodes are down but one is still online this should succeed

5: Bring both of the nodes back online
6: Reading the Data I just pushed to one node with R=1

如果我理解 R + W > N 正确,我现在应该有 2/3 的机会得到不一致的数据。这正是我想要展示的。

我的问题是:
是否有我需要禁用的选项,以便在节点重新联机时停止同步?

所以我需要禁用这些选项?

您需要禁用所有节点上的提示(将 cassandra.yaml 中的 hinted_handoff_enabled 设置为 false)- 在这种情况下,只有在您明确执行 [=14] 时才会发生复制=].

您还需要确保 read_repair_chancedclocal_read_repair_chance 设置为 0,以便您将在其中进行测试 table。最简单的方法是在创建 table:

时指定这些选项
create table (

....)
WITH read_repair_chance = 0.0 and dclocal_read_repair_chance = 0.0;