简体   繁体   中英

How to switch Redis database with Sidekiq on Rails 5.2.4?

My application uses Sidekiq and it's web monitoring interface. Sidekiq relies on one Redis instance, declared in the Sidekiq initializer:

sidekiq.rb in Development

 Sidekiq.configure_server do |config|
  config.redis = { url: 'redis://x821000109918b.adr.ch/:6379/0' }
 end

Sidekiq.configure_client do |config|
  config.redis = { url: 'redis://x821000109918b.adr.ch/:6379/0' }
end

Scheduling and monitoring jobs just works fine when in Development. Now I want to run the application in the Validation environment for a demonstration to business users. So when deploying to Validation, I try to connect to another Redis database on the same instance:

sidekiq.rb in Validation

 Sidekiq.configure_server do |config|
  config.redis = { url: 'redis://x821000109918b.adr.ch/:6379/1' }
 end

Sidekiq.configure_client do |config|
  config.redis = { url: 'redis://x821000109918b.adr.ch/:6379/1' }
end

After deploying and restarting the Validation server, I see that Sidekiq shows events of the Development environment. Changing the database parameter had no effect. Is there another place to define which Redis database to use?

Thanks for your help!

Remove the slash after ".ch".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM