Search code examples
rubyredissidekiq

Configuring 'redis-sentinel' gem with 'sidekiq'


Need help configuring 'redis-sentinel' gem with 'sidekiq'.

Getting this error -> Error fetching message: ERR unknown command 'sentinel'

Please see this gist (Start from the bottom) - https://gist.github.com/nitinstp23/6919253

Thanks in advance.


Solution

  • There is one missing step. You need to define Redis.current like so:

    redis_connection = proc {
      Redis.current = Redis.new(master_name: "mymaster", sentinels: sentinels[Rails.env])
    }
    redis = ConnectionPool.new(size: 10, &redis_connection)