Search code examples
ruby-on-railsrubyredisresqueresque-scheduler

How to connect with separate redis instance in resque rails


There are two in redis setup and their instances in my app. One for redis cache. I want that for background jobs I will use another instance.

I can't find a way where i define resqu to use specific redis address.


Solution

  • As described in the readme, you can point Resque to any Redis using the configuration file.

    # config/resque.yml:
    
    development: some_host:6379
    

    Then using redis-rails you can configure a different connnection for the cache, for example:

    # config/environments/development.rb:
    
    config.cache_store = :redis_store, "redis://other_host:6379/0/cache"
    

    You would need to fill it in for the other environments as well.