Skip to content

DOC-7167 Add Redis Sentinel connection examples to client connect pages - #4229

Open
andy-stark-redis wants to merge 1 commit into
mainfrom
DOC-7167
Open

andy-stark-redis wants to merge 1 commit into
mainfrom
DOC-7167

Conversation

@andy-stark-redis

@andy-stark-redis andy-stark-redis commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Adds a "Connect to Redis Sentinel" section to each client connect page, right after the cluster section. Fixes DOC-7167, part of epic DOC-7164.

What's on each page

Client Basic Separate Sentinel / data-node credentials Replica reads Failover caveat
redis-py ✓ ✓ ✓ slave_for() ✓
go-redis ✓ ✓ ✓ ReplicaOnly
node-redis ✓ ✓ ✓ replicaPoolSize
ioredis ✓ ✓ ✓ role: "slave" ✓ recommends failoverDetector
Jedis ✓ ✓ not supported (stated)
Lettuce ✓ ✓ ✓ MasterReplica + ReadFrom ✓ for RedisClient
StackExchange.Redis ✓ ✓ SentinelConnect() two-step form ✓ CommandFlags.PreferReplica
Predis ✓ ✓ ✓ (sticky until first write) ✓
hiredis Sentinel isn't supported (no Sentinel code in v1.4.1)

How the examples were tested

Every snippet was run against a local Sentinel setup: one primary, one replica, and three Sentinels watching mymaster (failover needs 2 of the 3 to agree). There were two variants: one with no auth, and one with different passwords for the data nodes and the Sentinels. The test copies differed from the page snippets only in ports, passwords and key names.

Versions tested:

Client Version Note
redis-py 8.1.0
go-redis v9.23.0
node-redis 6.3.0
ioredis 6.0.0
Jedis 8.0.2
Lettuce 7.8.0
StackExchange.Redis 3.0.0 Latest is 3.3.1; NuGet wasn't reachable from the test environment.
Predis 3.6.1

Please review: the failover caveats

We forced failovers with SENTINEL FAILOVER. Four clients kept writing to the old primary for about 10 seconds, until Sentinel turned it into a replica: redis-py, ioredis (default options), Lettuce RedisClient, and Predis. The old primary then discarded those writes, even though the client had received a success reply for each one. We measured 22 lost writes out of about 60.

go-redis, node-redis and Jedis listen for Sentinel's +switch-master announcement and switched within 1–2 seconds. The caveats on the four affected pages describe this behavior. They're based on our tests, not on any client's own documentation.

Not in this PR

  • Links to Sentinel URL forms in connection-urls.md. That page is still in an open DOC-7165 PR; I'll add the links once it merges.
  • StackExchange.Redis:
    • The newer SentinelUser/SentinelPassword options (3.1.13+) were checked in the source code but couldn't be run. The page shows the two-step form, which did run on 3.0.0.
    • There's no failover caveat yet, because 3.3.1 might already fix it and we couldn't test it.
  • Ruby and Rust. They have no connect pages, so they're follow-ups.
  • Untested: TLS connections to the Sentinels, and failover after a crashed primary (only forced failovers were tested).

🤖 Generated with Claude Code


Note

Low Risk
Documentation-only changes to client connect guides; no application or runtime code is modified.

Overview
Adds a Connect to Redis Sentinel section (placed after the cluster section) on nine client connect.md pages, with runnable examples for discovering the primary via Sentinels, split Sentinel vs data-node credentials, and replica read patterns where each client supports them.

Several pages document failover behavior: redis-py, ioredis (recommends failoverDetector), Lettuce (RedisClient vs MasterReplica), and Predis warn that the client may keep writing to the demoted primary until Sentinel closes the connection. hiredis gets an explicit note that Sentinel is unsupported. Jedis documents primary-only use (no replica reads).

Reviewed by Cursor Bugbot for commit 83aaa16. Bugbot is set up for automated code reviews on this repo. Configure here.

Adds a "Connect to Redis Sentinel" section after the cluster section on
the nine connect.md pages (H3 on Jedis to match its neighbors). hiredis
gets a short "not supported" section: v1.4.1 has no Sentinel code.

Every snippet ran against a local topology (primary, replica, three
Sentinels, mymaster, quorum 2) in two variants: no auth, and separate
data-node and Sentinel passwords. Test copies differed from the page snippets
only in ports, passwords, and key names. Versions run: redis-py
8.1.0 (GitHub tag source), go-redis v9.23.0, node-redis 6.3.0, ioredis
6.0.0, Jedis 8.0.2, Lettuce 7.8.0, StackExchange.Redis 3.0.0 (NuGet was
blocked; latest is 3.3.1), Predis 3.6.1.

The failover caveats are measured, not inferred. Under a forced
SENTINEL FAILOVER, redis-py, ioredis (default options), a Lettuce
RedisClient connection, Predis, and SE.Redis 3.0.0 kept writing to the
demoted primary for about 10 s, until Sentinel reconfigured it, and the
old primary discarded those acknowledged writes on resync (22 of about
60 in the measured runs). go-redis, node-redis, and Jedis subscribe to
+switch-master and moved within 1-2 s; ioredis with failoverDetector
cut loss to the inherent sub-second window. The .NET page deliberately
has no caveat: 3.3.1 adds an IsStalePrimaryView path that may close the
window, and 3.3.1 couldn't be run here (needs the .NET 10 SDK).

Surprises worth knowing before editing these sections: Jedis
RedisSentinelClient has no replica reads at all; Predis replica routing
is sticky until the first write and the parameters username leaks to
the Sentinels (hence username in each Sentinel URI); go-redis
ReplicaOnly sends writes to the replica too; redis-py sentinel_kwargs
stops socket_* inheritance.

Learned: five of eight clients silently lose ~10 s of writes after a graceful Sentinel failover
Constraint: every snippet here is run-verified (some trimmed to fragments of the tested program); re-run any edit against a real Sentinel topology
Rejected: SE.Redis SentinelUser/SentinelPassword options | 3.1.13+, source-read only, never run; page uses SentinelConnect + GetSentinelMasterConnection, which ran on 3.0.0
Rejected: Jedis .serverDefaultProtocol() to silence the 8.x RESP3 WARN | method doesn't exist in 7.x
Directive: add the SE.Redis failover caveat only after testing 3.3.1 or later under a forced failover
Directive: link Sentinel URL forms to connection-urls.md once DOC-7165 merges; it isn't on main yet
Gaps: no TLS to Sentinels tested on any client; no crash failover, only graceful SENTINEL FAILOVER; SE.Redis 3.3.1 never run
Recheck: SE.Redis credentials example when the .NET 10 SDK is available to run 3.3.1
Ticket: DOC-7167
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

DOC-7167

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🧠 Redis Memory

Found 5 related items from repository history (5 new this commit):

Memory updated at 83aaa16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clients Client library docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants