amakawa / redic

Lightweight Redis Client
MIT License
120 stars 14 forks source link

HA connection, handling failover with sentinel #5

Open luca3m opened 10 years ago

luca3m commented 10 years ago

Hi,

I wrote a RedicHA client which handles master discovering and failover when possible. Using sentinel as reference.

I tried my best to follow redic philosophy. What do you think about it? These are changes:

  1. Raise an exception when a client tries to write on a readonly slave, instead only returning RuntimeError
  2. Create a RedicHA class that handles this exception and CONNRefused one, asking sentinel again which is the master and reconnecting

thank you!