MongoDB - Split brain with 3 DC I have mongoDB in 3 DC's.

DC1 - 3 Nodes  with priority 300
DC2 - 3 Nodes  with priority 200
DC3 - 3 Nodes  with priority 100

Questions :-


Say, N/W is broken b/w DC1 &amp; DC2. But, still DC1 is able to communicate with DC3 and DC2 is also able to communicate with DC3. But DC1 will not be able to DC2.          Will it create 2 Primaries here, like 1 PRIMARY from DC1 and 1 PRIMARY from DC2?
What if there is no Priorities? Only DC3 will become PRIMARY?


Thanks
Will it create 2 Primaries here, like 1 PRIMARY from DC1 and 1 PRIMARY from DC2?


Assuming this deployment represents a single replica set, the expected outcome is either 1 primary or no primary.  In the event of network problems, a primary can only be sustained in the partition with a strict majority of voting members that are able to communicate with each other.

While replica sets can have up to 50 members in total, there is a maximum of 7 voting members so you cannot have 9 nodes with priorities.

If you have the maximum of 7 voting members distributed across your data centres, you will need at least 4 of those members healthy in order to elect (or sustain) a primary. If the current primary cannot see a majority of voting members, it will step down and become a secondary.


  DC1 - 3 Nodes with priority 300 DC2 - 3 Nodes with priority 200 DC3 - 3 Nodes with priority 100


If your intent is to prefer DC1 and DC2, that would likely mean having 3 voting members in DC1 and DC2 with a single voting member in DC3. With this configuration the primary would always be in DC1 if available, but preferentially in DC2 in the event DC1 is isolated. Majority votes could be achieved with all voting members in any two DCs available, or any degraded scenario with at least 4 voting members communicating in the replica set.

A primary would be unlikely in DC3, but possible transiently if DC1 is isolated and there is replication lag between DC1 and DC2 where the voting member in DC3 (with lowest priority) has a more current oplog than all eligible secondaries in DC2 (with medium priority). In this case, as soon as a higher priority member in DC2 has caught up with the lower priority primary in DC3, an election will be called so the higher priority member can be elected.

For more information, see:


Replica Sets Distributed Across Two or More Data Centres (MongoDB manual)
MongoDB Multi-Data Centre Deployments (White paper from MongoDB, Inc)