Skip to content

Fix Redis Sentinel connection issue by preserving Sentinel Master ID and Hosts in RedisConfig#61

Open
cetingokhan wants to merge 2 commits into
redis-field-engineering:masterfrom
cetingokhan:master
Open

Fix Redis Sentinel connection issue by preserving Sentinel Master ID and Hosts in RedisConfig#61
cetingokhan wants to merge 2 commits into
redis-field-engineering:masterfrom
cetingokhan:master

Conversation

@cetingokhan

Copy link
Copy Markdown

Summary

This PR addresses two key issues:

Sentinel Connection: Fixes a bug where configuring a [redis-sentinel] URI failed to establish a connection to the Redis Master because the Sentinel Master ID and Host details were lost during configuration parsing.

Build Environment: Updates the [Dockerfile] to use a supported Gradle image, as the previous OpenJDK image is deprecated and was causing build failures.

Changes

Modified [RedisConfig.java]: Updated [redisURIBuilder()] to explicitly check for sentinelMasterId and sentinels in the parsed URI. If present, they are now manually added to the [RedisURI.Builder] to ensure the final URI is correctly configured for Sentinel mode.

Updated [Dockerfile]: Replaced the deprecated openjdk:18-jdk-slim build image with gradle:8.10.0-jdk17. This fixes ./gradlew execution issues and ensures a stable build environment compatible with the project's Java 17 requirement.

Added Unit Test: Added [testRedisSentinelValueConfig] in [StreamSourceConnectorTest.java] to verify that [redis-sentinel] URIs are correctly parsed and that the Master ID and Sentinel hosts are preserved.

Testing

Unit Testing: Verified with the new test case [StreamSourceConnectorTest.testRedisSentinelValueConfig].

Integration Testing: Validated in a local Docker Compose environment with a dedicated Redis Sentinel setup.
Confirmed successful connection for both Sink and Source connectors using [redis-sentinel://] URIs.
Verified password authentication and consumer group functionality with Sentinel.

Build Verification: Confirmed that the project builds successfully with the new Dockerfile configuration.

Related Issue

Fixes [java.lang.IllegalStateException: Cannot build a RedisURI. One of the following must be provided Host, Socket or Sentinel] when using Sentinel and resolves build failures due to deprecated base images.

@cetingokhan

Copy link
Copy Markdown
Author

Hi @jruaux,
I hope you're doing well. I was wondering if there are any plans for an upcoming release soon? Also, I wanted to check if there is anything else I should update or improve in my Pull Request #61 to make it ready for inclusion.

Thanks for maintaining this great project!

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.

1 participant