#AWS側の設定
参考
https://qiita.com/leomaro7/items/f031cfdd7d12d5d5ccc5
https://lab.sonicmoov.com/development/aws/elasticache/
#Rails側の設定
config/environments/staging.rb
config.session_store :redis_store, {
servers: {
host: '[プライマリエンドポイント]',
port: 6379,
db: 0,
namespace: 'sessions'
},
expire_after: 60.minutes
}
config/initializers/sidekiq.rb
Sidekiq.configure_server do |config|
case Rails.env
when 'staging' then
redis_conn = proc {
Redis.new(host: 'プライマリエンドポイント', port: 6379, db: 2)
}
config.redis = ConnectionPool.new(size: 27, &redis_conn)
else
config.redis = { url: 'redis://127.0.0.1:6379' }
end
end
Sidekiq.configure_client do |config|
case Rails.env
when 'staging' then
redis_conn = proc {
Redis.new(host: 'プライマリエンドポイント', port: 6379, db: 2)
}
config.redis = ConnectionPool.new(size: 27, &redis_conn)
else
config.redis = { url: 'redis://127.0.0.1:6379' }
end
end