storage
storage copied to clipboard
[Feat] allow for usage of redis FailoverClient with Sentinel
We often use Redis Sentinel on Production environment for a more robust and highly available set up. This PR allows for configuration of Redis Sentinel on redis Storage Adapter and will not break any existing code.
Please consider merging this PR as some people might find this useful as well.
Thank you!
Changes:
allow config + init of redis FailoverClient with Sentinel to provide a more robust installation of Redis on Production environment.
- config.go: add relevant configuration options for Sentinel. These options will have not break existing code that depends on this library, if not configured explicitly.
- redis.go: add a step to init redis db with redis.NewFailoverClient() if EnableFailover=true (default false). To avoid breaking existing code, URL still takes precedent and only used to config Redis Standalone (i.e. cannot config Sentinel with URL as that would change the string format)
PS: Please let me know if anything needs revising.
thanks for the pull request,
can you(@binhnguyenduc ) please add unittest for initializing with the new variant and some explanations in the README.md?
after that i will merge it
@binhnguyenduc please check my last comment
@binhnguyenduc
@binhnguyenduc
Friendly bump @binhnguyenduc any plans to update this PR?
@ReneWerner87 I can finish this PR, or it can be closed. No one else has requested this feature
Issue here #382
I will work on it this week
I was about to add unit-tests for this, but this requires running multiple Redis instances with Sentinel enabled.
Follow on: #772