Commit 010dbf6c authored by felipe's avatar felipe Committed by GitHub

feat(proxyd): use a specific redis instance for consensus_ha (#9877)

parent 56f3d1b6
......@@ -123,6 +123,7 @@ type BackendGroupConfig struct {
ConsensusHA bool `toml:"consensus_ha"`
ConsensusHAHeartbeatInterval TOMLDuration `toml:"consensus_ha_heartbeat_interval"`
ConsensusHALockPeriod TOMLDuration `toml:"consensus_ha_lock_period"`
ConsensusHARedis RedisConfig `toml:"consensus_ha_redis"`
}
type BackendGroupsConfig map[string]*BackendGroupConfig
......
......@@ -335,8 +335,8 @@ func Start(config *Config) (*Server, func(), error) {
var tracker ConsensusTracker
if bgcfg.ConsensusHA {
if redisClient == nil {
log.Crit("cant start - consensus high availability requires redis")
if bgcfg.ConsensusHARedis.URL == "" {
log.Crit("must specify a consensus_ha_redis config when consensus_ha is true")
}
topts := make([]RedisConsensusTrackerOpt, 0)
if bgcfg.ConsensusHALockPeriod > 0 {
......@@ -345,7 +345,11 @@ func Start(config *Config) (*Server, func(), error) {
if bgcfg.ConsensusHAHeartbeatInterval > 0 {
topts = append(topts, WithLockPeriod(time.Duration(bgcfg.ConsensusHAHeartbeatInterval)))
}
tracker = NewRedisConsensusTracker(context.Background(), redisClient, bg, bg.Name, topts...)
consensusHARedisClient, err := NewRedisClient(bgcfg.ConsensusHARedis.URL)
if err != nil {
return nil, nil, err
}
tracker = NewRedisConsensusTracker(context.Background(), consensusHARedisClient, bg, bg.Name, topts...)
copts = append(copts, WithTracker(tracker))
}
......
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