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