[SERVER-26711] Not able to use secondary for read using Readpreference=secondary and nearest. Created: 20/Oct/16  Updated: 20/Oct/16  Resolved: 20/Oct/16

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Critical - P2
Reporter: Amit Agarwal Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Hi,

We are using mongodb with some node.js application and need to figure output to push the read connections to secondary/nearest secondary.

We tried couple of options with mongodb url
1) With replica set as below
mongodb://renewmedb_rw:renewmedb_rw123@renewmedbprd003las.io.askjeeves.info:27017/renewmedb?replicaSet=rs1&w=5&ReadPreference=NEAREST"

2)mongodb://renewmedb_rw:renewmedb_rw123@renewmedbprd001iad.io.askjeeves.info,renewmedbprd002iad.io.askjeeves.info,renewmedbprd003iad.io.askjeeves.info,renewmedbprd001las.io.askjeeves.info.renewmedbprd002las.io.askjeeves.info,renewmedbprd003las.io.askjeeves.info:27017/renewmedb?replicaSet=rs1&readPreference=secondary"

3) "mongodb://renewmedb_rw:renewmedb_rw123@renewmedbprd001iad.io.askjeeves.info,renewmedbprd002iad.io.askjeeves.info,renewmedbprd003iad.io.askjeeves.info,renewmedbprd001las.io.askjeeves.info.renewmedbprd002las.io.askjeeves.info,renewmedbprd003las.io.askjeeves.info:27017/renewmedb?readPreference=secondary&slaveOk=true"

All the connection goes to primary in case of replicaset and without replicates also it goes to primary alongwith all secondary because those are the part of URL.

Can someone help us to provide some details so we can push all reads just to secondaries?

Thanks,
Amit



 Comments   
Comment by Ramon Fernandez Marina [ 20/Oct/16 ]

Thanks for your report. Please note that the SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag, where your question will reach a larger audience. A question like this involving more discussion would be best posted on the mongodb-user group. See also our Technical Support page for additional support resources.

Regards,
Ramón.

Generated at Thu Feb 08 04:12:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.