go-redis
go-redis copied to clipboard
What's the difference between SentinelClient and FailoverClient?
First, I think SentinelClient is used redis sentinel strategy, but then I find there is FailoverClient which use sentinel strategy in it's comments. Now, I'm so confused, can someone explain difference between the two clients.
There is a discussion here :) https://github.com/go-redis/redis/issues/1179
@tomnlittle , I have a follow-up question. FailoverClient accepts a list of sentinel addresses in FailoverOptions. But SentinelClient accepts a single sentinel address. According to the Guidelines for Redis clients (redis.io/topics/sentinel-clients#guidelines-for-redis-clients-with-support-for-redis-sentinel), "the client should iterate the list of Sentinel addresses. " How can SentinelClient iterate through the rest of sentinel instances? Or do I miss something?
I also faced this problem...
I created issue #1451
I'm not sure I am referring to newer version but as per method NewFailoverClient documentation it already offers automatic failover:
NewFailoverClient returns a Redis client that uses Redis Sentinel for automatic failover. It's safe for concurrent use by multiple goroutines.
However if you want to iterate and create failover mechanics by your own you can use NewSentinelClient
in your business logic as it is done in NewFailoverClient
implementation, for example: https://github.com/go-redis/redis/blob/v8.3.3/sentinel.go#L512
I think you was mistaken since NewFailoverClient
describes a strategy while NewSentinelClient
describes just a type/struct used by a strategy.
thanks
------------------ 原始邮件 ------------------ 发件人: "notifications"<[email protected]>; 发送时间: 2020年11月5日(星期四) 凌晨0:56 收件人: "go-redis/redis"<[email protected]>; 抄送: "为为"<[email protected]>; "Comment"<[email protected]>; 主题: Re: [go-redis/redis] What's the difference between SentinelClient and FailoverClient? (#1310)
I'm not sure I am referring to newer version but as per method NewFailoverClient documentation it already offers automatic failover:
NewFailoverClient returns a Redis client that uses Redis Sentinel for automatic failover. It's safe for concurrent use by multiple goroutines.
However if you want to iterate and create failover mechanics by your own you can use NewSentinelClient in your business logic as it is done in NewFailoverClient implementation, for example: https://github.com/go-redis/redis/blob/v8.3.3/sentinel.go#L512
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
This issue is marked stale. It will be closed in 30 days if it is not updated.