Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default Sidekiq Redis configuration in Rails app

I'm trying to understand the Redis & Sidekiq configuration in a Passenger+Rails app and have run into some lack of understanding. I start the redis server independently of my rails app, while Sidekiq is a gem in my Rails app. I start it likewise: (no sidekiq.yml file needed for me)

bundle exec sidekiq

Following is my sidekiq.rb initializer:

require 'sidekiq'
require 'sidekiq-status'

Sidekiq.configure_client do |config|
  config.client_middleware do |chain|
    chain.add Sidekiq::Status::ClientMiddleware
  end
end

Sidekiq.configure_server do |config|
  config.server_middleware do |chain|
    chain.add Sidekiq::Status::ServerMiddleware, expiration: 30.minutes
  end
  config.client_middleware do |chain|
    chain.add Sidekiq::Status::ClientMiddleware
  end
end

I went through some library classes, but to no avail.

I want to understand where does Sidekiq configure it's Redis server details. It defaults to localhost:6379, but I am not quite sure how.
Also, if I wish to use Memcached in future, how can I change that?

like image 954
Sid Avatar asked Feb 07 '17 06:02

Sid


1 Answers

From sidekiq docs:

By default, Sidekiq tries to connect to Redis at localhost:6379

https://github.com/mperham/sidekiq/wiki/Using-Redis

You can change the port in the initializer:

 Sidekiq.configure_server do |config|
      config.redis = { url: 'redis://redis.example.com:7372/12' }
 end

From the looks of it sidekiq works only with redis

Sidekiq uses Redis to store all of its job and operational data.

like image 165
Joel Blum Avatar answered Sep 30 '22 13:09

Joel Blum