9

I have a bunch of sidekiq jobs running that are failing with the following error when I'm trying to perform a query to the DB:

No server is available matching preference: #<Mongo::ServerSelector::Primary:0x70249928071560 tag_sets=[] server_selection_timeout=30 local_threshold=0.015>

This seems to happen randomly, and not all the time. My mongoid.yml is structured as following:

hosts:
    - XX.XXX.XXX.X:27000
    - XX.XXX.XXX.XXX:27000
  database: acbde__production
  options:
    connect_timeout: 20
    read:
      mode: :secondary
    max_pool_size: 800
    replica_set: acbdeReplset

Anyone had this issue before?

absg
  • 377
  • 5
  • 9

2 Answers2

0

You should check whether mongodb is actually running.

You can use mongo --host IP --port PORT to check connection.

Yunqing Gong
  • 775
  • 7
  • 11
0

Most often this is happening because the application is trying to use clients across forks.

To do this properly, follow the instructions here and use the guidance here for troubleshooting.

D. SM
  • 13,584
  • 3
  • 12
  • 21