0

I've read quite a bit about mongodb replica set and how the elections work on a failover. My curiosity is assuming the client will use readPreference set to primary only, is there any advantage to having odd number of members against having even number of members + 1 arbiter?

For example if you have a 3 member replica set you can set all 3 members to be replicas or you can have only 2 replicas and an arbiter (which you can install on a smaller machine). The safety is basically the same, any machine can go down and the replica set is still ok, but if two of them go down then the replica set is in stalemate (it cannot elect a new primary). The only difference is that in the second case you can use a way smaller machine for the arbiter.

4

1 回答 1

1

实际上,三个数据保存节点提供与两个数据保存节点加一个仲裁器相同的“安全”网实际上是不正确的。

考虑以下情况:

1)您的一个节点丢失了磁盘,您需要完全重新同步它。如果您有三个数据保存节点,您可以从另一个辅助节点而不是主节点重新同步(这将减少主节点的负载)。

2) 你的一个节点丢失了它的磁盘,你需要一段时间才能找到一个新的。当该辅助节点关闭时,如果您有两个节点和一个仲裁器,那么您将使用零安全网运行,因为您只有一个节点还剩下数据,如果它发生任何事情,您就完蛋了。

于 2013-11-14T01:11:31.290 回答