Here's my scenario

  1. Sitecore 8.1 update 1 in Datacenter X
  2. Sitecore 8.1 update 1 in Datacenter Z (stand-by failover)
  3. MongoDB Replica Set (rs0) Primary and Secondary in Datacenter X
  4. MongoDB Replica Set (rs0) Secondary in Datacenter Z

The ConnectionStrings from Sitecore in Datacenter X, looks like this:


The Sitecore in Datacenter Z wants to guarantee that whenever a failover happens it uses MongoDB from the same datacenter (Datacenter Z) to avoid network latency, and wants to use the ConnectionStrings like this:


That being said, couple questions came to my mind:

  1. What Sitecore understands about Mongo from its ConnectionStrings?
  2. Changing the order of the ConnectionStrings makes sense to avoid network latency at all or Mongo is the one who decides/tells which one is the Primary or Secondary?
  3. Does the ConnectionStrings order matter to determine who is the Primary or Secondary to Sitecore?

1 Answer 1


From the standpoint of Sitecore, it doesn't do much as it will rely on the Mongo Driver to handle communications to the Mongo server(s) that are specified in the connection string.

You are not connected to a single server - you are connected to the entire replica set. Therefore since the driver keeps connections open to all members in the set it knows to send writes to the primary and it knows when it can send certain special reads to a secondary (unless it's a hidden secondary). This means the order that you specify in the connection string doesn't matter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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