Docs HomeMongoDB Manual

Three Member Replica Sets三个成员副本集

The minimum number of replica set members needed to obtain the benefits of a replica set is three members. 要获得副本集的好处,最少需要三个副本集成员。A three member replica set can have either three data-bearing members (Primary-Secondary-Secondary) (Recommended) or if circumstances (such as cost) prohibit adding a third data bearing member, two data-bearing members and an arbiter (Primary-Secondary-Arbiter). 三个成员的副本集可以有三个数据承载成员(主-次-次)(推荐),或者如果情况(如成本)禁止添加第三数据承载成员、两个数据承载构件和一个仲裁器(主-辅助仲裁器)。[1]

[1] For considerations when using an arbiter, see Replica Set Arbiter.有关使用仲裁器时的注意事项,请参阅副本集仲裁器

Primary with Two Secondary Members (P-S-S)具有两个次要成员的主要成员(P-S-S)

A replica set with three members that store data has:由三个成员组成的存储数据的复制副本集具有:

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

These deployments provide two complete copies of the data set at all times in addition to the primary. 除了主数据集外,这些部署还始终提供数据集的两个完整副本。These replica sets provide additional fault tolerance and high availability. 这些复制副本集提供了额外的容错性和高可用性If the primary is unavailable, the replica set elects a secondary to be primary and continues normal operation. The old primary rejoins the set when available.如果主副本不可用,则副本集会选择一个辅助副本作为主副本并继续正常操作。旧的主服务器在可用时重新加入集合。

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

Primary with a Secondary and an Arbiter (PSA)初级、次级和仲裁员(PSA)

Note

For considerations when using an arbiter, see Replica Set Arbiter.有关使用仲裁器时的注意事项,请参阅副本集仲裁器

A three member replica set with a two members that store data has:具有两个成员的三成员复制副本集存储数据,该复制副本集具有:

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

Since the arbiter does not hold a copy of the data, these deployments provides only one complete copy of the data. Arbiters require fewer resources, but at the expense of more limited redundancy and fault tolerance.由于仲裁器不保存数据的副本,因此这些部署只提供数据的一个完整副本。仲裁器需要更少的资源,但代价是更有限的冗余和容错。

However, a deployment with a primary, secondary, and an arbiter ensures that a replica set remains available if the primary or the secondary is unavailable. If the primary is unavailable, the replica set will elect the secondary to be 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.
Tip

See also: 另请参阅: