π³ (docker): add redis-sentinel#1255
Draft
douglasduteil wants to merge 3 commits into
Draft
Conversation
a19f8ae to
d3ca164
Compare
65df3ca to
76bd7c1
Compare
3dad7c6 to
6e202c1
Compare
6e202c1 to
f0e3e24
Compare
Contributor
|
J'ai la mΓͺme remarque et proposition que lΓ : #1263 (comment) |
017678f to
2b59256
Compare
**Problem** `redis.ts` reads direct-connect env vars (`HOST`, `PORT`, `PASSWORD`, `DB`, `TLS`) but not the sentinel ones. The `RedisConfig` DTO already declares the sentinel fields (`sentinels`, `name`, `sentinelPassword`) β they just had no env-var source. **Proposal** Read `Redis_SENTINELS`, `Redis_NAME`, `Redis_SENTINEL_PASSWORD`. When `Redis_SENTINELS` is non-empty, populate the sentinel fields and leave `host`/`port` undefined; otherwise keep the direct-connect fields. Document the new env vars.
**Problem** Local dev has only a plain `redis-pwd` (port 6379). Production runs a 1+1+3 sentinel cluster for HA, but there is no way to exercise the ioredis sentinel code path locally. **Proposal** `dks switch redis-sentinel` β local replica of the production HA topology so the ioredis [sentinel code path][ioredis-sentinel] can be exercised without deploying to k8s. [Redis Sentinel][redis-sentinel] is Redis's built-in HA mechanism. Sentinels are independent processes that monitor a master/replica pair and coordinate a failover β promoting the replica to master β when the master becomes unreachable. A quorum (the minimum number of sentinels that must agree the master is down before acting) prevents false failovers from transient network issues. At least 3 sentinels are required so quorum (N/2+1 = 2) can still be reached if one sentinel is lost. See [understanding sentinels][sentinel-tutorial]. - `redis-sentinel-master` / `redis-sentinel-replica` β [replication][redis-replication] pair; the replica is the standby that sentinels can promote on failover. - `redis-sentinel-1/2/3` β three sentinel processes monitoring `mymaster`, quorum 2; mirrors the 1+1+3 topology running in production. - `redis-sentinel` stack β aggregator that starts the full cluster in one command; waits for all nodes to be healthy before the stack is considered up. - `core-sentinel` β `core` variant whose env points at the sentinel cluster (`Redis_SENTINELS`, `Redis_NAME`) instead of the standalone `redis-pwd`; keeps `hostname: core` so nginx routes transparently without a new vhost. [ioredis-sentinel]: https://github.com/redis/ioredis#sentinel [redis-sentinel]: https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel/ [sentinel-tutorial]: https://redis.io/tutorials/operate/redis-at-scale/high-availability/understanding-sentinels/ [redis-replication]: https://redis.io/docs/latest/operate/oss_and_stack/management/replication/
WIP β remove before merge. Adds a third matrix entry to `test_e2e` so reviewers can see the sentinel code path exercised in CI alongside the regular `medium` run.
2b59256 to
b60c9d1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Local dev has only a plain
redis-pwd(port 6379). Production runs a1+1+3 sentinel cluster for HA, but there is no way to exercise the ioredis
sentinel code path locally.
Proposal
dks switch redis-sentinelβ local replica of the production HA topologyso the ioredis sentinel code path can be exercised
without deploying to k8s.
Redis Sentinel is Redis's built-in HA mechanism.
Sentinels are independent processes that monitor a master/replica pair
and coordinate a failover β promoting the replica to master β when the
master becomes unreachable. A quorum (the minimum number of sentinels
that must agree the master is down before acting) prevents false
failovers from transient network issues. At least 3 sentinels are
required so quorum (N/2+1 = 2) can still be reached if one sentinel is
lost. See understanding sentinels.
redis-sentinel-master/redis-sentinel-replicaβreplication pair; the replica is the standby that
sentinels can promote on failover.
redis-sentinel-1/2/3β three sentinel processes monitoringmymaster,quorum 2; mirrors the 1+1+3 topology running in production.
redis-sentinelstack β aggregator that starts the full cluster in onecommand; waits for all nodes to be healthy before the stack is
considered up.
core-sentinelβcorevariant whose env points at the sentinel cluster(
Redis_SENTINELS,Redis_NAME) instead of the standaloneredis-pwd;keeps
hostname: coreso nginx routes transparently without a new vhost.