OPTIONS
翻译或纠错本页面

三个节点的复制集

最基础的复制集架构是由三个节点组成的。在这样的复制集中,三个节点可以都拥有数据集,也可以是由两个拥有数据集的节点加上一个投票节点组成。

一个主节点与两个从节点

包含三个带有数据集的节点组成的复制集拥有:

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

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 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 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.

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.

参见

部署复制集.