Mongoose / MongoDB replica set using secondary for reads -
i changed server setup include replica set. secondary dbs located in multiple regions around world decrease latency. problem think of reads being done master , not secondary servers. i'm seeing 500ms+ latency in newrelic on servers far away master db, staging server, in same region master ~20ms. how can check if secondary read or nearest working, or have setting missing / wrong? (i have tried both secondary_preferred, , 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 this:
"replset": { "rs_name": "myrepset" "readpreference": "readpreference.secondary_preferred", "read_preference": "readpreference.secondary_preferred", "slaveok": true }
mongoose version: 3.8.x
as per project issues on github
there issue read preference not seem working when upgrading newest version (mongoose@3.8.1 & mongodb@1.3.23)
reads being done master , not secondary servers.
as per comments problem doesnot come when roll older version(mongoose@3.6.4 & mongodb@1.2.14
), reads start going secondaries(collection level). issue meant fixed in version 3.8.7
.
please reference following issues same:
https://github.com/automattic/mongoose/issues/1833 https://github.com/automattic/mongoose/issues/1895
Comments
Post a Comment