storage icon indicating copy to clipboard operation
storage copied to clipboard

[Feat] allow for usage of redis FailoverClient with Sentinel

Open binhnguyenduc opened this issue 2 years ago • 5 comments

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.

binhnguyenduc avatar Jul 27 '21 14:07 binhnguyenduc

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

ReneWerner87 avatar Jul 30 '21 18:07 ReneWerner87

@binhnguyenduc please check my last comment

ReneWerner87 avatar Aug 27 '21 08:08 ReneWerner87

@binhnguyenduc

ReneWerner87 avatar Sep 22 '21 06:09 ReneWerner87

@binhnguyenduc

ReneWerner87 avatar May 01 '22 10:05 ReneWerner87

Friendly bump @binhnguyenduc any plans to update this PR?

gaby avatar Aug 12 '22 14:08 gaby

@ReneWerner87 I can finish this PR, or it can be closed. No one else has requested this feature

gaby avatar Mar 28 '23 00:03 gaby

Issue here #382

I will work on it this week

gaby avatar Mar 28 '23 00:03 gaby

I was about to add unit-tests for this, but this requires running multiple Redis instances with Sentinel enabled.

gaby avatar Apr 09 '23 01:04 gaby

Follow on: #772

gaby avatar Apr 09 '23 01:04 gaby