MongoDB replication: how to keep the possibility of writing to a replica set with a single "surviving" member

StackOverflow https://stackoverflow.com/questions/21454819

سؤال

I have a MongoDB replica set of 3 machines. When two of them go down, the last one doesn't change its state to PRIMARY and it is not possible to write to database. Is it possible to make the last survivor a PRIMARY?

هل كانت مفيدة؟

المحلول

It is technically possible to set the votes and eligibility of other members from becoming primary, this way MongoDB will only ever see one eligible member, however, in an automated manner the answer is no.

Once the majority of the set is offline MongoDB will, by default, halt writes and primary read preference.

نصائح أخرى

You could add an arbiter (see documentation) to help with the election. Without having to maintain an extra mongod server.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top