Skip to content

fix(redis): harden sentinel primary validation - #10

Open
im0x0ing wants to merge 4 commits into
labring:fix/0.9.1-baselinefrom
im0x0ing:fix/redis-sentinel-primary-validation
Open

fix(redis): harden sentinel primary validation#10
im0x0ing wants to merge 4 commits into
labring:fix/0.9.1-baselinefrom
im0x0ing:fix/redis-sentinel-primary-validation

Conversation

@im0x0ing

@im0x0ing im0x0ing commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

This change hardens Redis startup against Sentinel split-brain.

  • Read all Sentinel instances and require a majority before accepting a master.
  • Verify the selected candidate really reports role:master via INFO replication.
  • Fail closed when existing Redis data is present but no trusted primary can be established.
  • Keep the default-ordinal fallback only for first bootstrap on an empty data directory.

Testing

  • bash -n addons/redis/scripts/redis-start.sh
  • git diff --check
  • Test cluster reproduction: normal bootstrap, 1:2 Sentinel split, and fail-closed behavior when no quorum exists.

Require Sentinel quorum, confirm the selected Redis reports role:master before writing replicaof, and refuse default fallback once data already exists.
@im0x0ing
im0x0ing force-pushed the fix/redis-sentinel-primary-validation branch from 537ac4d to f4926ad Compare August 4, 2026 06:50
@pull-request-size pull-request-size Bot added size/M and removed size/L labels Aug 4, 2026
Comment thread addons/redis/scripts/redis-start.sh
Comment thread addons/redis/scripts/redis-start.sh Outdated
Truncate redis.conf before rebuilding it to prevent settings from accumulating across container restarts.
Capture the redis-cli exit status before restoring shell tracing so timeout and connection failures are retried instead of being treated as successful queries.
Comment thread addons/redis/scripts/redis-start.sh Outdated
Use CUSTOM_SENTINEL_MASTER_NAME when configured and fall back to the component name for Sentinel master discovery.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants