0

Hello guys I've been all over the MongoDB documentation (http://docs.mongodb.org) and I can't find a solution to my problem. Imagine the following scenario:

I have 2 Nodes (1000Km apart). Both nodes can communicate with the other; Node1 has several replicasets and therefore several Masters, Slaves and Arbiters; Node2 has a replica (slave) and a hidden replica (hidden slave) of each Master in Node1. Here's a diagram to help you guys understand enter image description here

I want to know what might happen if:

The link between the two nodes fails; My guess is the non hidden slaves in Node2 will be elected Masters. What happens when the link between nodes returns? 2 masters?

Node 1 fails completely; Same scenario? 2 Masters when Node1 returns?

Is this the best way to do this? Any sugestions on how should I do it so I won't lose any information if Node1 fails completely (avoiding the two masters situation)

0

So assuming that node(n) is a physical box, and the host(n) is a mongod process...If the link between the nodes fails, nothing cool will happen :).

node1 will continue operating as normal, and node2 will just sit there asking wtf. The regular secondary will only have 2/4 votes which is not the strict majority.

If node1 fails, then you will have to manually configure the secondary on node2 as the primary.

When node1 comes back online, the previous primary will come back online as a secondary and it will detect any unfinished writes, and do a rollback which will require manual intervention.

Keeping in mind that you need a strict majority to elect a new primary, I would try putting the arbiters on their own system that is independent of the two nodes.

  • Tks, but according to this: docs.mongodb.org/manual/tutorial/… hidden members do vote so, will that make node2 have a master? – MyNameIsRui Oct 10 '14 at 10:37
  • No, node2 will never have enough members to automatically elect a primary because you have to have >50% of the members up and voting to do the election. No matter how you configure a 2 node setup there will always be one that does not have enough votes in a failure scenario and will require manual intervention to create a primary. Essentially, automatic failover in both directions is not possible with 2 locations, you need a 3rd location for that to happen automatically – Adam C Oct 10 '14 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.