diff --git a/proxyd/config.go b/proxyd/config.go index cd0cca135101..3c622f86ddb6 100644 --- a/proxyd/config.go +++ b/proxyd/config.go @@ -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 diff --git a/proxyd/proxyd.go b/proxyd/proxyd.go index 7af47b1a7d20..b85342938590 100644 --- a/proxyd/proxyd.go +++ b/proxyd/proxyd.go @@ -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)) }