0

I want to have mongod replication for redundancy across multiple sites.

I'm thinking of deploying the following: Deploy 5 Mongod instances (has to be an odd number, or else needs an arbitrator), have 3 on site A and 2 on site B.

If site B goes down, it's all good we still have 3 running on site A. But if site A goes down then we'll only have 2 Mongods running. Is this okay? Which one is going to become the master? Can they manage it themselves till I manually start a third one?

Second question, how will mongo deal with after the sites are reconnected?

Reza S
  • 9,480
  • 3
  • 54
  • 84
  • The answer is pretty much described here: http://docs.mongodb.org/manual/core/replica-set-architecture-geographically-distributed/ – Reza S Apr 05 '14 at 21:56

1 Answers1

1

A mongo replica set will only be available if more than 50% of the nodes are available.

In your case if Site A failed then your replica set will go offline

A possible alternative is to run 2 replica nodes in A and 2 in B. Then on an external location either run an arbitrator or a delayed replica.

The delayed replica would provide a further backup of your data, however I would make sure that you set its priority to 0, this will ensure that whilst it is a voting member it will not get promoted to the primary.

Having a third site may not be feasible but it is the safest approach.

The complications will obviously come with ensuring that you secure the communications between Site A -> Site C, Site B -> Site C.

If you are truly limited to 2 Sites, then the only real way to ensure that the replica set remains healthy would be to monitor the number of nodes that are healthy and have some auto scale function to ensure that you always have enough nodes to vote on a primary. However I would think in this solution you would still end up with some downtime whilst a new server was started and added to the replica set.

SCB
  • 3,034
  • 2
  • 25
  • 24
  • To be clear. The replica set would not go "Offline", it would be unable to elect a primary and thus be unable to be written to. You could still read from this set with a read preference of secondary/secondaryPreferred or setting rs.slaveOk() – daveh Apr 17 '14 at 06:06