Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-26711

Not able to use secondary for read using Readpreference=secondary and nearest.

    XMLWordPrintableJSON

Details

    • Icon: Question Question
    • Resolution: Done
    • Icon: Critical - P2 Critical - P2
    • None
    • None
    • None
    • None

    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

      Attachments

        Activity

          People

            Unassigned Unassigned
            pintuag23 Amit Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: