我想在演示中明确显示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的机会获得不一致的数据。这正是我要显示的内容。
我的问题是:我是否需要禁用某个选项才能停止节点重新联机时的同步?
所以我需要禁用这些选项?
您需要在所有节点上禁用提示(将hinted_handoff_enabled
中的cassandra.yaml
设置为false
)-在这种情况下,仅当您明确地执行nodetool repair
时,复制才会发生。
[您还需要确保将要进行测试的表的read_repair_chance
和dclocal_read_repair_chance
设置为0。最简单的方法是在创建表时指定这些选项:
create table (
....)
WITH read_repair_chance = 0.0 and dclocal_read_repair_chance = 0.0;