5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Sidekiqで使うRedisの指定方法

Posted at

Sidekiqで使うRedisの指定方法を、忘れる前にメモ。

Sidekiq.configure_server do |config|
  config.redis = {
    'url' => 'redis://localhost:6379/5'  # /5はデータベースの番号
  }
end

Sidekiq.configure_client do |config|
  config.redis = {
    'url' => 'redis://localhost:6379/5'  # /5はデータベースの番号
  }
end

Redis Sentinelを使う場合

Sidekiq.configure_server do |config|
  config.redis = {
    'url' => 'redis://mymaster/5',
    'sentinels' => {
      [ host: 'foo.example.com', port: 26379 ],
      [ host: 'bar.example.com', port: 26379 ],
      [ host: 'baz.example.com', port: 26379 ]
    }
  }
end

Sidekiq.configure_client do |config|
  config.redis = {
    'url' => 'redis://mymaster/5',
    'sentinels' => {
      [ host: 'foo.example.com', port: 26379 ],
      [ host: 'bar.example.com', port: 26379 ],
      [ host: 'baz.example.com', port: 26379 ]
    }
  }
end

Namespace (redis-namespace)を使う場合:

Sidekiq.configure_server do |config|
  config.redis = {
    'url' => 'redis://localhost:6379/5',
    'namespace' => 'mynamespace'
  }
end

Sidekiq.configure_client do |config|
  config.redis = {
    'url' => 'redis://localhost:6379/5',
    'namespace' => 'mynamespace'
  }
end
5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?