我可能错过了,但我不知道您可以将其配置为从从站读取?但是,这是我的主 + 2 从配置:
config.cache_store = :redis_store, {
url: 'redis://prestwick/1',
sentinels: [{host: 'prestwick.i', port: 26379}, {host: 'carnoustie.i', port: 26379}, {host: 'birkdale.i', port: 26379}],
role: 'master',
expires_in: 1.hour
}
如果有用的话,我对通用 REDIS 对象和 Sidekiq 的配置(在 config/initializers/001_redis.rb 中):
redis_options = {
url: 'redis://prestwick/0',
sentinels: [{host: 'prestwick.i', port: 26379}, {host: 'carnoustie.i', port: 26379}, {host: 'birkdale.i', port: 26379}],
role: 'master'
}
redis_sidekiq_options = {
url: 'redis://prestwick/2',
sentinels: [{host: 'prestwick.i', port: 26379}, {host: 'carnoustie.i', port: 26379}, {host: 'birkdale.i', port: 26379}],
role: 'master'
}
REDIS = Redis.new(redis_options)
Sidekiq.configure_server do |config|
config.redis = redis_sidekiq_options
end
Sidekiq.configure_client do |config|
config.redis = redis_sidekiq_options
end