Redis failover and high availability

588 views
Skip to first unread message

bhavin.t

unread,
Nov 17, 2010, 11:09:56 PM11/17/10
to Redis DB
Hi all

While the replication guide is fairly clear on how one can achieve
master-slave replication, what is not clear is how one achieves high
availability. I wish to confirm my understanding below -

* One can setup redis replication to replicate from a master to a
slave. all writes go to the master and all reads go to the master and
slave
* If the master fails we would need some script that checks for this
failure and then perform the following steps -
** convert the slave to a master by removing the slave config and
restarting
*** is there anyway of doing this WITHOUT restarting redis on the
slave?
** start sending all read and write queries to the slave
** convert the master to a slave once it comes back up
* the above nonetheless will result in downtime to the extent of time
it takes to
** detect the master is down
** restart the slave

Over and above this one needs to prevent
* flapping
* incorrect downtime detection

Can someone confirm if the above is correct? Is there a better way of
achieving HA?

Thanks
Bhavin Turakhia
CEO, Directi

teleo

unread,
Nov 18, 2010, 4:17:45 AM11/18/10
to Redis DB
Hi,

You can use "SLAVEOF no one" to promote a slave to a master, without
restarting it. The data will not be lost.

Similarly, when the former master comes back online, it needs to
become SLAVEOF the new master - and that will cause the former master
to discard its data and resync against the new master.

The problem of detection and failover indeed requires scripting and is
very problematic in terms of availability. In the future, Redis
Cluster will do the failover automatically. But the problem of
availability will only be partially solved: even the cluster will have
some temporary loss of availability during the switch, albeit brief,
for some portion of the data.

As for flapping, I suggest you avoid flapping by performing an
automatic failover only once, and require manual intervention for
further failovers.

- Teleo

On Nov 18, 6:09 am, "bhavin.t" <bhavi...@directi.com> wrote:
> Hi all
>
> While the replication guide is fairly clear on how one can achieve
> master-slave replication, what is not clear is how one achieves high
> availability. I wish to confirm my understanding below -
>
> * One can setup redis replication toreplicate from a master to a
Reply all
Reply to author
Forward
0 new messages