Three Member Replica Sets三个成员副本集

On this page本页内容

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:包含三个存储数据的成员的副本集具有:

  • One primary.一个主节点
  • Two secondary members. 二级成员。Both secondaries can become the primary in an election.选举中,这两个次要候选人都可以成为主要候选人。
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:包含两个成员的三成员副本集存储数据:

  • One primary.
  • One secondary member. The secondary can become primary in an election.次要选民在选举中可以成为主要选民。
  • One arbiter. The arbiter only votes in elections.仲裁人只在选举中投票。
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: 参阅:
←  Replica Set Deployment ArchitecturesReplica Sets Distributed Across Two or More Data Centers →