【问题标题】:Test Cassandras R + W > N测试 Cassandras R + W > N
【发布时间】:2020-01-11 11:18:40
【问题描述】:

我想在演示文稿中明确显示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 cassandra-2.0 cassandra-3.0


    【解决方案1】:

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

    您还需要确保将要进行测试的表的read_repair_chancedclocal_read_repair_chance 设置为0。最简单的方法就是在创建表时指定这些选项:

    create table (
    
    ....)
    WITH read_repair_chance = 0.0 and dclocal_read_repair_chance = 0.0;
    

    【讨论】:

    • 那么除了read repairhinted handoff 之外,cassandra 中的节点之间没有循环同步吗?那是我实际上问自己的事情。因为在我看来,读取修复和hinted_handoff 似乎足以在一段时间后变得一致。
    • 没有自动...这就是 nodetool repair 存在的原因
    • 刚刚检查了一切,它工作正常 :) 非常感谢!
    猜你喜欢
    • 2013-12-07
    • 1970-01-01
    • 2015-01-05
    • 1970-01-01
    • 2012-10-21
    • 2012-08-22
    • 1970-01-01
    • 2021-05-04
    • 1970-01-01
    相关资源
    最近更新 更多