Search code examples
ruby-on-railsrubypostgresqlsidekiq

PG::ConnectionBad Sidekiq could not translate host name


We are getting a lot of sentries issue with PG:ConnectionBad on Postgres in RDS AWS and Ruby on Rails

PG::ConnectionBad Sidekiq/BookingExtensionCheckWorker

could not translate host name “ls-XXXXXXXXXXXXfee44.XXXXXXXXX.eu-west-1.rds.amazonaws.com” to address: Name or service not known

In two weeks ago, we have migrate a new database and we change endpoint in the RoR files api

new database endpoint,

ls-XXXXXXXXXXXXXXXf3d4a.XXXXXXXX.eu-west-1.rds.amazonaws.com

It working fine with no issue between the new database and Ruby on Rails api. however, I get a lot of sentries issue said that sidekiq having an issue with connection database as they use old database address which it’s no longer used. I have to check sidekiq database; the code shows it’s connected to the new database. They keep go back to the old database when I run Ruby on rails.

Is there some way to find why sidekiq keep connection old database


Solution

  • Sidekiq is background service. So when someone deployed he has used some sort of like. Right now you are getting issue you think is fine but actually most jobs are not running. Which you will noticed in few days.

    How can you check jobs If you sidekiq setup. Probably following url will lead to all jobs.

    your_url/sidekiq
    

    It will show you all jobs, I think you have option here to restart services. Just click to restart sidekiq. And everything would be fine.

    How to start

    As your sidekiq running with old configuration. So following steps could be dangrous, I think you must check how you have started your process. Otherwise following are some way people configure it and runt it.

    systemctl restart sidekiq
    

    If this does not work, check your command your deployment guy has setup some sort of scripts inside /etc/init.d folder Some time developer use following simple line to run sidekiq

    bundle exec sidekiq -d -P tmp/sidekiq.pid -L log/sidekiq.log 
    

    or

    bundle exec sidekiqctl stop