gpt4 book ai didi

mysql - CAP 定理 - 为什么 Mysql 是 CA

转载 作者:行者123 更新时间:2023-12-04 08:40:45 26 4
gpt4 key购买 nike

根据 CAP

Consistency - All nodes gave the same data

Availability means the ability to access the cluster even if a node inthe cluster goes down.

Partition tolerance means that the cluster continues to function evenif there is a "partition" (communication break) between two nodes(both nodes are up, but can't communicate).


但 Mysql 默认行为是主从或主主。
所以为了,主从
  • 没有一致性,因为可能会发生从站滞后,因此从从站读取的数据不一致。
  • 没有可用性,因为没有 DBA 干预,slave 不能成为 master。

  • So For, Master-Master
  • 没有一致性,因为可能会发生从站滞后,因此从从站读取的数据不一致。
  • 没有可用性,因为没有 DBA 干预,slave/other-master 不能成为 master。
  • 它的部分容忍度,因为在网络故障的情况下两者都可以正常工作。

  • 我错过了什么吗?

    最佳答案

    MySQL 数据库引擎通过引入节点来平衡集群设计,从而达到 CAP 定理。
    因此,当您有两 (2) 个节点时,如果两台服务器之间存在网络问题,集群将被分成 2 个分区。并且每个人将拥有成员(member)总数的 50%(1/2)。这就是为什么没有一个分区会达到法定人数,也没有一个允许查询。因此,要获得完整的分区容错性,集群设计至少需要添加第三个节点,以便您的数据库达到一次故障的分区容错性。
    enter image description here
    因此,集群 即使两个节点之间的“ 分区 ”(通信中断)(两个节点都已启动,但无法通信)仍继续运行,因为一个分区仍然有仲裁(2/3 = 66%,即大于 50%)。

    关于mysql - CAP 定理 - 为什么 Mysql 是 CA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64578822/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com