I recently changed my server setup to include a replica set. The secondary DBs are located in multiple regions around the world to decrease latency. The problem is that I think all of the reads are being done from the master and not from the secondary servers. I'm seeing 500ms+ latency in newrelic on servers far away from the master DB, but the staging server, which is in the same region as the master is ~20ms. How can I check if the secondary read or nearest is working, or do I have a setting missing / wrong? (I have tried both SECONDARY_PREFERRED, and NEAREST)
Url:
mongodb://1.1.1.1:27017,1.1.1.2:27017,1.1.1.3:27017,1.1.1.4:27017,1.1.1.5:27017/mydatabase
My options look like this:
"replSet": {
"rs_name": "myRepSet"
"readPreference": "ReadPreference.SECONDARY_PREFERRED",
"read_preference": "ReadPreference.SECONDARY_PREFERRED",
"slaveOk": true
}
Mongoose version: 3.8.x