MongoDB ReplicaSet - PRIMARY role falls to SECONDARY when only PRIMARY is left

后端 未结 4 1392
梦谈多话
梦谈多话 2021-01-03 07:33

I am investigating using MongoDB ReplicaSet for high availability.

But just discovered that in ReplicaSet with 3 nodes, if PRIMARY mongod is the only one left (that

4条回答
  •  清酒与你
    2021-01-03 08:09

    Try to use arbiters, most documents say to use just one, but in you case, you need to win the election.

    From http://docs.mongodb.org/manual/core/replica-set-architectures/ :

    Fault tolerance for a replica set is the number of members that can become unavailable and still leave enough members in the set to elect a primary. In other words, it is the difference between the number of members in the set and the majority needed to elect a primary. Without a primary, a replica set cannot accept write operations. Fault tolerance is an effect of replica set size, but the relationship is not direct.

    More on elections: http://docs.mongodb.org/manual/core/replica-set-elections/

    More on arbiters: http://docs.mongodb.org/manual/faq/replica-sets/#how-many-arbiters-do-replica-sets-need

提交回复
热议问题