Here's my scenario
- Sitecore 8.1 update 1 in Datacenter X
- Sitecore 8.1 update 1 in Datacenter Z (stand-by failover)
- MongoDB Replica Set (rs0) Primary and Secondary in Datacenter X
- MongoDB Replica Set (rs0) Secondary in Datacenter Z
The ConnectionStrings from Sitecore in Datacenter X, looks like this:
...
mongodb://primaryx,secondaryx,secondaryz/Analytics?replicaSet=rs0
mongodb://primaryx,secondaryx,secondaryz/Tracking_Live?replicaSet=rs0
mongodb://primaryx,secondaryx,secondaryz/Tracking_History?replicaSet=rs0
mongodb://primaryx,secondaryx,secondaryz/Tracking_Contact?replicaSet=rs0
...
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:
...
mongodb://secondaryz,primaryx,secondaryx/Analytics?replicaSet=rs0
mongodb://secondaryz,primaryx,secondaryx/Tracking_Live?replicaSet=rs0
mongodb://secondaryz,primaryx,secondaryx/Tracking_History?replicaSet=rs0
mongodb://secondaryz,primaryx,secondaryx/Tracking_Contact?replicaSet=rs0
...
That being said, couple questions came to my mind:
- What Sitecore understands about Mongo from its ConnectionStrings?
- 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?
- Does the ConnectionStrings order matter to determine who is the Primary or Secondary to Sitecore?