Docs 菜单

三节点副本集

要实现副本集的优势,副本集至少需要三个节点。三节点副本集可以具有三个数据承载节点(主节点-从节点-从节点)(推荐),如果情况(例如成本)禁止添加第三个数据承载节点,则可以是两个数据承载节点加一个仲裁节点(主节点-从节点-仲裁节点)。[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.
点击放大

另请参阅: