Redis Master-Master Replication

6,312 views
Skip to first unread message

Lalit Deshmukh

unread,
Dec 18, 2016, 9:56:08 AM12/18/16
to Redis DB
Hi,

I am trying to make M-M replication on two redis instance. Is it possible, if yes, please guide me, secondly what could be the risk element if M-M replication is.

If already doemnt is no o

Regards
Lalit kuamr 

Salvatore Sanfilippo

unread,
Dec 18, 2016, 10:09:26 AM12/18/16
to redi...@googlegroups.com
Hello, no Master-Master replication is supported by Redis.
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to redis-db+u...@googlegroups.com.
> To post to this group, send email to redi...@googlegroups.com.
> Visit this group at https://groups.google.com/group/redis-db.
> For more options, visit https://groups.google.com/d/optout.



--
Salvatore 'antirez' Sanfilippo
open source developer - Redis Labs https://redislabs.com

"If a system is to have conceptual integrity, someone must control the
concepts."
— Fred Brooks, "The Mythical Man-Month", 1975.

hva...@gmail.com

unread,
Dec 18, 2016, 4:01:10 PM12/18/16
to Redis DB
Redis doesn't have support for master-master replication.  However, there are a couple of designs that can come close.

The first design is to use Sentinel.  Sentinel is a daemon that comes with recent versions of Redis, which monitors a group of Redis servers (1 master and 1+ slaves), and, when the master fails, can promote a slave to become the new master and tell the other slaves to replicate from the new master.  Client programs poll Sentinel to learn who are the master and slave servers in the group, and find out when a failover to a new master has occurred.  Sentinel does not truly duplicate a master-master configuration, but it automates the change from a failed master to a new one, and clients can change too.

The second design is to use the Redis single-master replication in a chain of three servers:

[master1]--->[master2]--->[slave]

A load balancer or DNS would send client connections to the master1 machine for writes.  The clients connect to the slave machine for reads.  Writes made to master1 will pass through master2 and appear on slave.  If the master1 Redis fails, the load balancer/DNS would switch to sending client connections to the master2 machine for writes.  The clients continue connecting to the slave machine for reads.  Writes made to master2 will appear on slave.

There are benefits and drawbacks to each of these two designs.  They don't duplicate master-master replication exactly, but they offer ways to avoid the master being a single point of failure.

  -Greg

Akbar Ahmed

unread,
Dec 22, 2016, 3:02:42 PM12/22/16
to Redis DB
For Master-Master replication checkout https://github.com/Netflix/dynomite

Venkatesh Ravi

unread,
Feb 23, 2017, 2:54:17 AM2/23/17
to Redis DB
Hi,
Do you have the document to do the 2 process you mentioned.

or can you tell how redis master 2 gets data from redis master 1.

hva...@gmail.com

unread,
Feb 23, 2017, 9:56:31 PM2/23/17
to Redis DB
The machine I labeled "master 2" is actually a slave.  A slave that doesn't have any commands disabled.  It's configured to be a slave of master 1, so it gets data from master 1 through ordinary master/slave replication.  The other slaves are configured to be slaves of master 2.  If master 1 fails, clients can connect instead to master 2 and the data continues to flow to the slaves.

As I said, this does not duplicate true master/master functions.  It offers a way to avoid a single point of failure in the master part of the group of Redis servers.

sravs

unread,
May 23, 2018, 1:12:27 PM5/23/18
to Redis DB
what does it mean by 'A slave that doesn't have any commands disabled.'  how is it different from regular slave setup ?

hva...@gmail.com

unread,
May 23, 2018, 11:41:31 PM5/23/18
to Redis DB

See https://redis.io/topics/replication#read-only-slave for an explanation of the default slave configuration.  (the whole page is useful reading, but that particular section in the middle has the answer to your question)
Reply all
Reply to author
Forward
0 new messages