Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-149

Allow option to read from slaves from replication set and write to master only

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • 2.1
    • None
    • None

    Description

      The issue is we have massive update written to master. We want to have fast response for read. It will be nice to have a way to specify that read options should only go to slaves and writes only go to master within the replication set.

      From: Eliot Horowitz <eliothorowitz@gmail.com>
      To: mongodb-user@googlegroups.com
      Sent: Thu, August 19, 2010 2:39:00 PM
      Subject: Re: [mongodb-user] Java Driver Connection Question for Replication Set

      Couple of comments:

      • only 1 machine out of the 12 can be a master at any time
      • the java driver is designed to give it any # of servers, and it'll
        send all writes/reads to the master
      • we can add an option in the java driver to send reads to slaves,
        can you open a jira case?
      • you really need more data center awareness than we support right
        now, though its planned

      Can you give us a little more info about what you're trying to do overall?

      One option right is this:

      • make A1, B1, C1, D1 have priority 1 and the other priorities 0.
        Then only the 1s can be master
      • in each data center, make a List<ServerAddress> with all the nodes
        in your datacenter and all the 1s.
      • doing read slave support is pretty simple in the java driver if needed

      On Thu, Aug 19, 2010 at 5:20 PM, Joseph Wang <josephykwang@yahoo.com> wrote:
      > We have 3 colos. For each colo, we want to have 4 machines participating in a
      > replication set.
      > For discussion purpose, let's name these machine A1, A2, A3, A4, B1, B2, B3, B4,
      > C1,
      > C2, C3, and C4. Let A1, B1, C1, and D1 be the original masters. We want read to
      > hit slaves.
      >
      > Update processor w/i each colo will send updates to master w/i the corresponding
      > colo.
      >
      > Looking at http://api.mongodb.org/java/2.1/index.html, it is not clear how one
      > will specify
      > the connection string for replication set. It has example for replication pair.
      >
      > 1. What should the connection string be used for read for each colo? Note that
      > we only want
      > read to hit slaves since we've high updates hitting master w/i a colo.
      > 2. What should the connection string be used for write for each colo? Couldn't
      > be just A1 since
      > there is a possibility of A1 failure.
      > 3. Is it possible to specify that machines in colo A should hit slaves in colo A
      > then hit slaves
      > in colos B and C if all machines in A have problem?
      >
      >

      • make A1, B1, C1, D1 have priority 1 and the other priorities 0.
        Then only the 1s can be master
      • in each data center, make a List<ServerAddress> with all the nodes
        in your datacenter and all the 1s.
      • doing read slave support is pretty simple in the java driver if needed

      Attachments

        Activity

          People

            eliot Eliot Horowitz (Inactive)
            josephykwang Joseph Wang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: