ryanlecompte / redis_failover

redis_failover is a ZooKeeper-based automatic master/slave failover solution for Ruby.
http://github.com/ryanlecompte/redis_failover
MIT License
539 stars 65 forks source link

Prevent reads on slaves #49

Closed lloydmeta closed 11 years ago

lloydmeta commented 11 years ago

Is it possible to make it so that slaves are not used for reads at all?

I know I can set the slave-serve-stale-data setting on the slave to 'no' but I think this will involve one attempt to read from the slave, getting a reply of "SYNC with master in progress", then reading from the master. In the case, I think performance will be adversely affected.

ryanlecompte commented 11 years ago

There is a "master_only" option that you can set when you create your RedisFailover::Client. All reads and writes will go to the master only. This should be covered in the README, I believe.

On Jan 20, 2013, at 9:04 PM, Lloyd notifications@github.com wrote:

Is it possible to make it so that slaves are not used for reads at all?

I know I can set the slave-serve-stale-data setting on the slave to 'no' but I think this will involve one attempt to read from the slave, getting a reply of "SYNC with master in progress", then reading from the master. In the case, I think performance will be adversely affected.

— Reply to this email directly or view it on GitHub.

lloydmeta commented 11 years ago

Ah, that's what master_only means :) sorry about that!

By the way thanks for the awesome library!

ryanlecompte commented 11 years ago

Cool! You're welcome. :-)

On Jan 20, 2013, at 9:46 PM, Lloyd notifications@github.com wrote:

Ah, that's what master_only means :) sorry about that!

By the way thanks for the awesome library!

— Reply to this email directly or view it on GitHub.