Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4204

Getting Random No server is available matching preference on Replica Set

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 12_01_17
    • Affects Version/s: 5.0.1
    • Component/s: None
    • None
    • Environment:
      Ubuntu, Sinatra, Sidekiq
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Hello,

      On my Sinatra App I'm getting random errors (it does not occur all the time) to a mongodb replica set when trying to write on the DB.
      The error is the following:
      No server is available matching preference: #<Mongo::ServerSelector::Primary:0x25372200 tag_sets=[] server_selection_timeout=30 local_threshold=0.015>

      Anyone can help on how to avoid this? Could this be related with the connection pool size, should it be higher?

      My mongoid.yml has the following options:

      options:
      connect_timeout: 15
      read:
      mode: :secondary
      max_pool_size: 500
      replica_set: newAnalyticsReplset

            Assignee:
            emily.stolfo Emily Stolfo (Inactive)
            Reporter:
            antonio.gorgulho@getsocial.io António Gorgulho
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None