Allow user specified host in connection with sentinel #620
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.
Hi! It's my first time contributing to an open source project, so feel free to point out if i made something wrong
What is the problem?
I am trying to use redis as an external cache for latency-critical application that is scaled on three different physical servers
So for each application instance situation looks like this:
We have one redis instance that is available locally and two redis instances that are available but will cost a few net hops to reach (we want to avoid that at all costs). Preferred behavior is to always send readonly operations to local redis instance if possible, and if it is not alive, then we must go to any other available instance
The main issue is net latency with
Redis
client created withSentinel
and configured to read fromRole::SLAVE
because it chooses random host, but I want to specify preferred oneSuggestion
Allow user to specify host+port in
ConnectionOptions
and if it is suitable according to configuration, then use itIf user leaves host unspecified the behavior of connection pool with sentinel will be the same - randomly choose host from available replicas
Example
Before changes:
After changes