Repository navigation
feat(redis): Redis Sentinel high-availability support (v2.0) - #15
Merged
Merged
Conversation
Previously sentinelMaster/sentinels were parsed, exposed, and logged but never used -- initializeRedisConnection() always built a direct JedisPooled to host:port, so a Sentinel deployment got no failover (silent). Now, when both TOMCAT_REDIS_SESSION_SENTINEL_MASTER and TOMCAT_REDIS_SESSION_SENTINELS are set, the manager connects via JedisSentineled: it discovers the current master through the sentinels and fails over automatically. The master connection inherits username, password, database, SSL, and timeout; sentinel nodes are queried with timeout/SSL only. Without sentinel config, behavior is unchanged (direct JedisPooled). Connection construction is split into isSentinelConfigured() / buildSentinelConnection() / buildStandaloneConnection() for clarity. Documents the two env vars in the README. Bumps version 1.8 -> 2.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… standalone)
setSentinels("") (e.g. an empty context.xml Manager attribute) yields a
HashSet containing a single empty string, which is non-empty as a set, so
isSentinelConfigured() returned true and the connection path handed
JedisSentineled an empty sentinel set -- failing instead of falling back to
the documented standalone connection. Require at least one non-blank entry.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Codex Autonomous Review:
The incremental change fixes the previously reported blank-sentinel edge case by requiring at least one non-blank sentinel entry before enabling Sentinel mode. I did not find any new bugs introduced by this update. Tip: comment with "/codex address comments" to attempt automated fixes for unresolved review threads. |
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.
Summary
Makes Redis Sentinel actually work. Before this,
sentinelMaster/sentinelswere parsed, exposed via getters, and printed in the startup banner — butinitializeRedisConnection()always built a directJedisPooledtohost:port. A deployment that configured Sentinel for HA silently got no failover.Now, when both
TOMCAT_REDIS_SESSION_SENTINEL_MASTERandTOMCAT_REDIS_SESSION_SENTINELSare set, the manager connects throughJedisSentineled, which discovers the current master from the sentinel nodes and fails over automatically when the master changes.Details
DefaultJedisClientConfig).ConnectionPoolConfig(which extendsGenericObjectPoolConfig<Connection>) for the master pool.isSentinelConfigured()/buildSentinelConnection()/buildStandaloneConnection().Bumps version 1.8 → 2.0 (Sentinel is a significant new capability).
Verification
Compiles against the real Jedis 4.4.6 API (constructor/builder signatures verified against the jar). Runtime failover was not exercised — that needs a live Sentinel cluster (1 master + replicas + ≥1 sentinel). Reviewers with a Sentinel environment should smoke-test master discovery and a failover.
🤖 Generated with Claude Code