flyerhzm / redis-sentinel

another redis automatic master/slave failover solution for ruby by using built-in redis sentinel (deprecated)
MIT License
188 stars 67 forks source link

Allow client to return list of slaves #38

Closed ksol closed 10 years ago

ksol commented 10 years ago

Context: I'm developing an application which reads (never writes) from a redis database. This database has a master and two slaves, and three sentinels to monitor the whole thing. I'm already using this gem to handle failovers, but since we're only reading, I'd like to be able to read from the slaves as well. It does not matter if the masters and the slaves are a bit out of sync in my case.

So I added two methods, Redis#slaves and Redis#all_clients, with the first one returning only the slaves clients, and the second one returning the slaves + the master clients.

Please let me know if there is anything on your mind regarding this feature, thanks!

flyerhzm commented 10 years ago

@ksol I see why you need slaves method, but is all_clients necessary?

ksol commented 10 years ago

I'm not convinced by the name, but yes I think it is necessary. I want to read from all redis instances, regardless of wether they're master or slave.