go-redis
go-redis copied to clipboard
SentinelClient has no Masters method
I get the following when trying to use SentinelClient.Masters()
sentinel.Masters undefined (type *redis.SentinelClient has no field or method Masters)
My code is as follows:
sentinel := redis.NewSentinelClient(&redis.Options{
Addr: "redis-ha:26379",
Password: "",
})
master := sentinel.Masters()
I'm not 100% that this will bring me back the masters, but I can't check that because I get the error above. This is using redis 5.0.6 and golang 1.12
Just for context I’ve moved from a single redis to a sentinel setup, and previous I was using NewClient() but that will attempt to connect to a slave sometimes and fail to write, so I want to connect to the master only when doing writes
with multi sentinels you should use redis.NewFailoverClient then program will connect to master when write
This issue is marked stale. It will be closed in 30 days if it is not updated.