Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1238

Add config option to randomly distribute client requests to all mongos servers in a sharded cluster

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.3
    • Component/s: Sharded Cluster
    • Labels:
      None

      I am currently using Mongoid 5.2.1 and Mongo 2.4.3

      My mongoid yml config file looks something like this:

      production:
        clients:
          default:
            hosts:
              - 1.1.1.1:27017
              - 1.1.1.2:27017
              - 1.1.1.3:27017
      

      If I type User.collection.cluster I am returned:

      => #<Mongo::Cluster:0x69935083945360 servers=[#<Mongo::Server:0x69935083943980 address=1.1.1.1:27017>, #<Mongo::Server:0x69935083909280 address=1.1.1.2:27017>, #<Mongo::Server:0x69935083889460 address=1.1.1.3:27017>] topology=Sharded>
      

      So I see that the mongo gem is aware that my topology is "Sharded" and has the correct list of server addresses, but all my client requests go only to the first server listed, 1.1.1.1:27017.

      I searched the code base for a config option to evenly or randomly distribute my client requests to all three Mongos servers, but I do not see one.

      Thanks!

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            mattruzicka@gmail.com Matthew Ruzicka
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: