On this page本页内容
In a three-member replica set with a primary-secondary-arbiter (PSA) architecture or a sharded cluster with three-member PSA shards, a data-bearing node that is down or lagged can lead to performance issues.在具有主辅仲裁器(PSA)体系结构的三成员副本集或具有三成员PSA分片的分片集群中,数据承载节点停机或滞后可能会导致性能问题。
If one data-bearing node goes down, the other node becomes the primary. 如果一个数据承载节点发生故障,另一个节点将成为主节点。Writes with w:1
continue to succeed in this state but writes with write concern "majority"
cannot succeed and the commit point starts to lag. w:1
的写入在此状态下继续成功,但写入关注点为"majority"
的写入无法成功,提交点开始延迟。If your PSA replica set contains a lagged secondary and your replica set requires two nodes to majority commit a change, your commit point also lags.如果PSA副本集包含滞后的次要副本集,并且副本集需要两个节点来多数提交更改,则提交点也会滞后。
With a lagged commit point, two things can affect your cluster performance:对于延迟的提交点,有两件事会影响集群性能:
majority commit point
.To reduce the cache pressure and increased write traffic, set 要降低缓存压力并增加写入流量,请为不可用或滞后的节点设置votes: 0
and priority: 0
for the node that is unavailable or lagging. votes: 0
和priority: 0
。For write operations issued with "majority", only voting members are considered to determine the number of nodes needed to perform a majority commit. 对于以“多数”发出的写操作,只考虑投票成员来确定执行多数提交所需的节点数。Setting the configuration of the node to 将节点配置设置为votes: 0
reduces the number of nodes required to commit a write with write concern "majority"
from two to one and allows these writes to succeed.votes: 0
将提交具有写入关注点"majority"
的写入所需的节点数量从两个减少到一个,并允许这些写入成功。
Once the secondary is caught up, you can use the 一旦第二个被捕获,您可以使用rs.reconfigForPSASet()
method to set votes
back to 1
.rs.reconfigForPSASet()
方法将votes
设置回1
。
In earlier versions of MongoDB, 在早期版本的MongoDB中,enableMajorityReadConcern
and --enableMajorityReadConcern
were configurable allowing you to disable the default read concern "majority"
which had a similar effect.enableMajorityReadConcern
和--enableMajorityReadConcern
是可配置的,允许您禁用具有类似效果的默认读取关注点"majority"
。
To reduce the cache pressure and increased write traffic for a deployment with a three-member primary-secondary-arbiter (PSA) architecture, set 要减少使用三成员主辅助仲裁器(PSA)架构的部署的缓存压力和增加的写入流量,请为不可用或滞后的辅助仲裁器设置{ votes: 0, priority: 0 }
for the secondary that is unavailable or lagging:{ votes: 0, priority: 0 }
:
cfg = rs.conf(); cfg["members"][<array_index>]["votes"] = 0; cfg["members"][<array_index>]["priority"] = 0; rs.reconfig(cfg);
If you want to change the configuration of the secondary later, use the 如果您想稍后更改辅助服务器的配置,请使用rs.reconfigForPSASet()
method.rs.reconfigForPSASet()
方法。