Commit 69f8fcf5 by liyijie

feat: redis支持cluster

parent c4b6c031
redis_config = { url: ENV["REDIS_URL"] }
redis_config.merge!(password: ENV["REDIS_PASSWORD"]) if ENV["REDIS_PASSWORD"].present?
redis_config.merge!(db: ENV["REDIS_DB"]) if ENV["REDIS_DB"].present?
if ENV['REDIS_CLUSTER_URL'].present?
# cluster模式
redis_config = { cluster: [ ENV["REDIS_CLUSTER_URL"] ] }
redis_config.merge!(password: ENV["REDIS_PASSWORD"]) if ENV["REDIS_PASSWORD"].present?
else
redis_config = { url: ENV["REDIS_URL"] }
redis_config.merge!(password: ENV["REDIS_PASSWORD"]) if ENV["REDIS_PASSWORD"].present?
redis_config.merge!(db: ENV["REDIS_DB"]) if ENV["REDIS_DB"].present?
end
Sidekiq.configure_server do |config|
config.redis = redis_config
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment