go-redis
go-redis copied to clipboard
Sending reads to replica nodes on non-zero db not possible?
Expected Behavior
I am using Sentinel with 1 primary and 2 replicas. I want to send read-only commands to the replicas, on ANY DB number, not just DB 0.
Current Behavior
Today, looks like it's not possible to do this with FailoverClient
. If I switch to FailoverClusterClient
it will work, but it forces me to use DB 0. Since I am not using Redis Cluster, I should be able to use the other DBs, but this is not supported.
I saw some PRs and discussion in the past that apparently add support for this, but I'm not able to find it in either v8 or v9: https://github.com/redis/go-redis/pull/1199
A possible fix was suggested here, but no maintainers have responded: https://github.com/redis/go-redis/issues/2824
Frankly it is surprising that go-redis doesn't seem to support this, while other Redis libraries for other languages have long supported this. Am I just missing something? Please advise, thanks.