On this page本页内容
In some circumstances (such as when you have a primary and a secondary, but cost constraints prohibit adding another secondary), you may choose to add an arbiter to your replica set. 在某些情况下(例如,当您有一个主副本和一个辅助副本,但成本限制禁止添加其他辅助副本),您可以选择将仲裁器添加到副本集。An arbiter participates in elections for primary but an arbiter does not have a copy of the data set and cannot become a primary.仲裁员参与primary
选举,但仲裁员没有数据集的副本,因此无法成为primary
。
An arbiter has exactly 一名仲裁员正好有1
election vote. 1
张选举票。By default an arbiter has priority 默认情况下,仲裁器的优先级为0
.0
。
Do not run an arbiter on systems that also host the primary or the secondary members of the replica set.不要在同时承载副本集的主要或次要成员的系统上运行仲裁器。
To add an arbiter, see Add an Arbiter to Replica Set.要添加仲裁器,请参阅将仲裁器添加到副本集。
Arbiters are not supported with quarterly rapid releases releases. 季度快速发布不支持仲裁员。If your deployment includes arbiters, only use LTS releases.如果您的部署包含仲裁器,请仅使用LTS版本。
If you are using a three-member primary-secondary-arbiter (PSA) architecture, the write concern 如果您使用的是三成员主次仲裁器(PSA)体系结构,如果次仲裁器不可用或滞后,写问题"majority"
can cause performance issues if a secondary is unavailable or lagging. "majority"
可能会导致性能问题。See Mitigate Performance Issues with PSA Replica Set for advice on how to mitigate these issues.有关如何缓解这些问题的建议,请参阅使用PSA副本集缓解性能问题。
For the following MongoDB versions, 对于以下MongoDB版本,与带有仲裁器的副本集的pv1
increases the likelihood of w:1
rollbacks compared to pv0
(no longer supported in MongoDB 4.0+) for replica sets with arbiters:pv0
(MongoDB 4.0+不再支持)相比,pv1
增加了w:1
回滚的可能性:
See Replica Set Protocol Version.请参见副本集协议版本。
Use a single arbiter to avoid problems with data consistency. 使用单个仲裁器来避免数据一致性问题。Multiple arbiters prevent the reliable use of the majority write concern.多个仲裁器阻止可靠地使用多数写关注点。
To ensure that a write will persist after the failure of a primary node, the majority write concern requires a majority of nodes to acknowledge a write operation. 为了确保在主节点发生故障后写入操作将持续,多数写入问题需要多数节点确认写入操作。Arbiters do not store any data, but they do contribute to the number of nodes in a replica set. 仲裁器不存储任何数据,但它们会影响副本集中的节点数。When a replica set has multiple arbiters it is less likely that a majority of data bearing nodes will be available after a node failure.当副本集有多个仲裁器时,大多数数据承载节点在节点故障后不太可能可用。
If a secondary node falls behind the primary, and the cluster is 如果辅助节点落后于主节点,并且集群被重新配置,则来自多个仲裁器的投票可以选择落后的节点。reconfigured
, votes from multiple arbiters can elect the node that had fallen behind. The new primary will not have the unreplicated writes even though the writes could have been majority committed by the old configuration. 新的主配置不会有未复制的写入,即使这些写入可能是由旧配置提交的。The result is data loss.结果是数据丢失。
To avoid this scenario, use at most a single arbiter.为了避免这种情况,最多使用一个仲裁器。
When running with 当使用authorization
, arbiters exchange credentials with other members of the set to authenticate. authorization
运行时,仲裁器与集合的其他成员交换凭据以进行身份验证。MongoDB encrypts the authentication process, and the MongoDB authentication exchange is cryptographically secure.MongoDB对身份验证过程进行加密,MongoDB身份验证交换是加密安全的。
Because arbiters do not store data, they do not possess the internal table of user and role mappings used for authentication. 因为仲裁器不存储数据,所以它们不拥有用于身份验证的用户和角色映射的内部表。 Thus, the only way to log on to an arbiter with authorization active is to use the localhost exception.因此,在授权激活的情况下登录仲裁器的唯一方法是使用localhost异常。
The only communication between arbiters and other set members are: votes during elections, heartbeats, and configuration data. 仲裁员和其他集合成员之间的唯一通信是:选举期间的投票、心跳和配置数据。These exchanges are not encrypted.这些交换没有加密。
However, if your MongoDB deployment uses TLS/SSL, MongoDB will encrypt all communication between replica set members. 但是,如果MongoDB部署使用TLS/SSL,MongoDB将加密副本集成员之间的所有通信。See Configure 有关更多信息,请参阅为TLS/SSL配置mongod
and mongos
for TLS/SSL for more information.mongod
和mongos
。
As with all MongoDB components, run arbiters in trusted network environments.与所有MongoDB组件一样,在可信网络环境中运行仲裁器。
For example, in the following replica set with 2 data-bearing members (the primary and a secondary), an arbiter allows the set to have an odd number of votes to break a tie:例如,在以下具有2个数据承载成员(主要成员和次要成员)的副本集中,仲裁器允许该集拥有奇数票以打破平局: