文档菜单
文档首页
/
MongoDB 手册
/ /

三个成员副本集

本页内容

  • 一个主节点和两个副节点(P-S-S)
  • 一个主节点、一个副节点和一个仲裁者(PSA)

为了获得副本集的好处,所需的最小副本集成员数为三个。一个由三个成员组成的副本集可以包含三个承载数据的成员(主-副-副)(推荐),或者如果情况(如成本)禁止添加第三个承载数据的成员,则可以有两个承载数据的成员和一个仲裁员(主-副-仲裁员)。 [1]

[1] 关于使用仲裁员的考虑,请参见副本集仲裁员.

存储数据的三个成员的副本集具有

  • 一个 主。

  • 两个 成员。两个副成员都可以在 选举中成为主。

Diagram of a 3 member replica set that consists of a primary and two secondaries.

这些部署在所有时间都提供数据集的两个完整副本,除了主之外。这些副本集提供额外的容错性和 高可用性。如果主不可用,副本集将选举一个副成员成为主并继续正常操作。当旧主可用时,它将重新加入集。

Diagram of an election of a new primary. In a three member replica set with two secondaries, the primary becomes unreachable. The loss of a primary triggers an election where one of the secondaries becomes the new primary
点击放大

注意

关于使用仲裁员的考虑,请参见 副本集仲裁员。

具有两个存储数据成员的三个成员副本集具有

Diagram of a replica set that consists of a primary, a secondary, and an arbiter.

由于仲裁者不保存数据副本,这些部署只提供一份完整的数据副本。仲裁者需要更少的资源,但代价是冗余和容错能力更有限。

然而,包含主副本、辅助副本和仲裁者的部署确保了即使主副本或辅助副本不可用,副本集仍然可用。如果主副本不可用,副本集将选举辅助副本成为主副本。

Diagram of an election of a new primary. In a three member replica set with a secondary and an arbiter, the primary becomes unreachable. The loss of a primary triggers an election where the secondary becomes new primary.
点击放大

提示

另请参阅

返回

部署架构