Skip to content

feat(redis): support redis sentinel configuration#41568

Open
akantcheff wants to merge 4 commits intoappsmithorg:releasefrom
akantcheff:feature/support-redis-sentinel
Open

feat(redis): support redis sentinel configuration#41568
akantcheff wants to merge 4 commits intoappsmithorg:releasefrom
akantcheff:feature/support-redis-sentinel

Conversation

@akantcheff
Copy link

Description

Add Redis Sentinel support to the Appsmith server.

  • Add redis-sentinel:// scheme support in both reactiveRedisConnectionFactory() and redisClient() beans
  • Extract credentials parsing into a shared extractCredentials() method with proper validation for both null and empty sentinel master name
  • Add APPSMITH_REDIS_SENTINEL_MASTER environment variable mapping in application-ce.properties for consistency with other APPSMITH_* env vars
  • Add log.info() to each scheme branch in reactiveRedisConnectionFactory() for startup observability

Configuration

Environment variable Description Example
APPSMITH_REDIS_URL Redis URL with sentinel scheme redis-sentinel://sentinel-host:26379
APPSMITH_REDIS_SENTINEL_MASTER Sentinel master name mymaster

Authentication is supported via URL: redis-sentinel://username:password@sentinel-host:26379

Fixes #11976

cc @appsmithorg/query-widgets-pod

Thanks to contributors: @m-k8s @benjaminParisel @abirembaut

Automation

/ok-to-test tags=""

🔍 Cypress test results

Caution

If you modify the content in this section, you are likely to disrupt the CI result for your PR.

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Add `redis-sentinel://` scheme support in both `reactiveRedisConnectionFactory()` and `redisClient()` beans. Extract credentials parsing into a shared `extractCredentials()` method and add a `fillAuthentication()` overload for `RedisURI.Builder`. Sentinel master name is configured via `appsmith.redis.sentinel.master` property.
Add `log.info()` statements to each scheme branch (`redis`, `rediss`, `redis-sentinel`, `redis-cluster`) in `reactiveRedisConnectionFactory()` for better observability at startup.
Cover all scheme branches (standalone, SSL, sentinel, cluster), authentication variants (no auth, user+password, password-only), error cases (invalid scheme, missing sentinel master as null and empty string), and custom port.
Cover all scheme branches (standalone, SSL, sentinel, cluster), authentication variants, sentinel master validation (null and empty string), client option verification, and scheme conversion for cluster. Add `@AfterEach` cleanup for Lettuce client resources.
@github-actions
Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Feb 26, 2026
@akantcheff
Copy link
Author

@NilanshBansal are you interesting by this feature request?

@github-actions github-actions bot removed the Stale label Mar 3, 2026
@github-actions
Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Mar 10, 2026
@github-actions
Copy link

This PR has been closed because of inactivity.

@github-actions github-actions bot closed this Mar 17, 2026
@akantcheff
Copy link
Author

@Nikhil-Nandagopal @NilanshBansal 🆙 👋

@NilanshBansal
Copy link
Contributor

@vivek-appsmith @manish535 @subrata71 @salevine can you please check this?

@subrata71 subrata71 reopened this Mar 18, 2026
Copy link
Collaborator

@subrata71 subrata71 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @akantcheff for this contribution! Redis Sentinel support has been a long-standing community ask. Appreciate the effort.

That said, there are a few items that need to be addressed before we can proceed with this.

validateSentinelMaster();
final RedisSentinelConfiguration sentinelConfig = new RedisSentinelConfiguration()
.master(redisSentinelMaster)
.sentinel(redisUri.getHost(), redisUri.getPort());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current implementation only supports a single sentinel node. In production, Redis Sentinel deployments typically have 3+ sentinel nodes for quorum. A single sentinel node defeats the purpose of Sentinel (if that one sentinel goes down, the client can't discover the master).

isCluster = true;
// java clients do not support redis-cluster scheme
if (redisurl.startsWith("redis-cluster://")) {
redisurl = "redis://" + redisurl.substring("redis-cluster://".length());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing code has rediss:// for standalone SSL connections. There's no equivalent rediss-sentinel:// or TLS option for the sentinel connection. In cloud environments (AWS ElastiCache, Azure Cache), sentinel with TLS is common.

void testReactiveRedisConnectionFactory_WithStandaloneRedis_CreatesStandaloneConfiguration() {
// Given
String redisUrl = "redis://localhost:6379";
ReflectionTestUtils.setField(redisConfig, "redisURL", redisUrl);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Tests use ReflectionTestUtils.setField() heavily, which is brittle if field names change.

# Redis Properties
appsmith.redis.url=${APPSMITH_REDIS_URL}
appsmith.redis.git.url=${APPSMITH_REDIS_GIT_URL:${APPSMITH_REDIS_URL}}
appsmith.redis.sentinel.master=${APPSMITH_REDIS_SENTINEL_MASTER:}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No Helm/Docker documentation update: I thinkdeploy/helm/values.yaml and deploy/helm/templates/configMap.yaml need updates to support the new APPSMITH_REDIS_SENTINEL_MASTER env var. @wyattwalter Could you please confirm?

@@ -67,6 +67,7 @@ sentry.environment=${APPSMITH_SERVER_SENTRY_ENVIRONMENT:}
# Redis Properties
appsmith.redis.url=${APPSMITH_REDIS_URL}
appsmith.redis.git.url=${APPSMITH_REDIS_GIT_URL:${APPSMITH_REDIS_URL}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concern: If a user sets APPSMITH_REDIS_GIT_URL to a sentinel URL, it will be passed to bash/RTS code that likely doesn't understand the redis-sentinel:// scheme. @sondermanish @wyattwalter What do you think?

fillAuthentication(redisUri, sentinelConfig);
final LettuceClientConfiguration clientConfig =
LettuceClientConfiguration.builder().build();
return new LettuceConnectionFactory(sentinelConfig, clientConfig);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QQ: Does it provide connection pooling out of the box? Or is it not covered in the current implementation?

@github-actions github-actions bot removed the Stale label Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Redis Sentinel Support

3 participants