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] | |
Primary with Two Secondary Members (P-S-S)primary以及两个secondary成员(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.两个secondary成员。两个secondary都可以在选举中成为primary。
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.如果主副本不可用,则副本集会选择一个次副本作为主副本,并继续正常操作。旧的主要在可用时重新加入集合。
Primary with a Secondary and an Arbiter (PSA)primary、secondary和仲裁员(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.一个secondary成员。在选举中,secondary可以成为primary。One arbiter. The arbiter only votes in elections.一个仲裁者。仲裁者只在选举中投票。
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.但是,具有主、次和仲裁器的部署可确保在主或次不可用时副本集仍然可用。如果主副本不可用,副本集将选择次副本作为主副本。