Summary
The aggregator's Redis client is currently constructed for a single endpoint only. In HA deployments (ha-compose.yml, sharding-ha-compose.yml) two aggregators share one Redis container, making Redis a single point of failure even though MongoDB and the aggregator itself are HA.
Current state
internal/storage/factory.go:42-51 calls redislib.NewClient(&redislib.Options{Addr: ...}) with a single Host:Port. internal/config/config.go:111-123 only exposes Host, Port, Password, DB, plus pool/timeout fields. There is no SentinelAddrs, MasterName, or cluster node list. No NewFailoverClient / NewClusterClient / NewUniversalClient is called anywhere in the repo.
The library already in use (github.com/redis/go-redis/v9) supports Sentinel and Cluster natively, so the change is small.
Proposed change
Switch the constructor in factory.go to redislib.NewUniversalClient and extend RedisConfig with Sentinel-related fields:
REDIS_SENTINEL_ADDRS — comma-separated host:port list; when non-empty, Sentinel mode is used.
REDIS_MASTER_NAME — Sentinel master name (required when REDIS_SENTINEL_ADDRS is set).
REDIS_SENTINEL_PASSWORD — Sentinel auth password (optional).
REDIS_SENTINEL_USERNAME — Sentinel ACL username (optional).
REDIS_ROUTE_BY_LATENCY / REDIS_ROUTE_RANDOMLY — read routing knobs.
UniversalClient keeps the existing single-Addr path working unchanged when no Sentinel addresses are configured, so this is fully backwards compatible.
Acceptance criteria
RedisConfig exposes the Sentinel fields above, wired through env vars with sensible defaults (empty = disabled).
factory.go uses NewUniversalClient and constructs the appropriate options based on whether SentinelAddrs is set.
- Existing single-endpoint deployments work without any config change.
- Unit test proves the right client type is selected for each config shape.
- README and
changes.txt updated per the project's documentation guidelines.
Out of scope
- Redis Cluster mode (separate concern, can be a follow-up).
- A
sentinel-compose.yml example is nice-to-have but not required for this issue.
Summary
The aggregator's Redis client is currently constructed for a single endpoint only. In HA deployments (
ha-compose.yml,sharding-ha-compose.yml) two aggregators share one Redis container, making Redis a single point of failure even though MongoDB and the aggregator itself are HA.Current state
internal/storage/factory.go:42-51callsredislib.NewClient(&redislib.Options{Addr: ...})with a singleHost:Port.internal/config/config.go:111-123only exposesHost,Port,Password,DB, plus pool/timeout fields. There is noSentinelAddrs,MasterName, or cluster node list. NoNewFailoverClient/NewClusterClient/NewUniversalClientis called anywhere in the repo.The library already in use (
github.com/redis/go-redis/v9) supports Sentinel and Cluster natively, so the change is small.Proposed change
Switch the constructor in
factory.gotoredislib.NewUniversalClientand extendRedisConfigwith Sentinel-related fields:REDIS_SENTINEL_ADDRS— comma-separatedhost:portlist; when non-empty, Sentinel mode is used.REDIS_MASTER_NAME— Sentinel master name (required whenREDIS_SENTINEL_ADDRSis set).REDIS_SENTINEL_PASSWORD— Sentinel auth password (optional).REDIS_SENTINEL_USERNAME— Sentinel ACL username (optional).REDIS_ROUTE_BY_LATENCY/REDIS_ROUTE_RANDOMLY— read routing knobs.UniversalClientkeeps the existing single-Addrpath working unchanged when no Sentinel addresses are configured, so this is fully backwards compatible.Acceptance criteria
RedisConfigexposes the Sentinel fields above, wired through env vars with sensible defaults (empty = disabled).factory.gousesNewUniversalClientand constructs the appropriate options based on whetherSentinelAddrsis set.changes.txtupdated per the project's documentation guidelines.Out of scope
sentinel-compose.ymlexample is nice-to-have but not required for this issue.