gpt4 book ai didi

java - 从主故障恢复后,Mongo Java 驱动程序是否恢复正常的写入操作?

转载 作者:行者123 更新时间:2023-11-30 04:05:08 25 4
gpt4 key购买 nike

到目前为止,我从 Mongo 手册中了解到:

(Mongo Server) ... the replica set will attempt to select another member to become the new primary. The first secondary that receives a majority of the votes becomes primary.

(Client operation) ... Use primaryPreferred if you want an application to read from the primary under normal circumstances, but to allow stale reads from secondaries in an emergency.

(Driver) The MongoDB Java driver handles failover in replicated setups with tuneable levels of transparency to the user. By default, a MongoClient connection object will ignore failures of secondaries, and reads will only throw a MongoException when the primary node is unavailable.

  • 当 Mongo 服务器选出新的主节点时,客户端驱动程序是否会意识到新的主节点?
  • 在主节点发生故障并选出新的主节点后,客户端驱动程序是否会恢复正常的写入操作?

最佳答案

如果您向 MongoClient 提供 replSet 成员列表,驱动程序将在选举过程完成后尝试查找新的主节点。

关于java - 从主故障恢复后,Mongo Java 驱动程序是否恢复正常的写入操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20967981/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com