questions about cross datacenter replication

457 views
Skip to first unread message

Liu Yubao

unread,
Nov 27, 2013, 8:17:22 PM11/27/13
to redi...@googlegroups.com
Hi all,

I want to setup two Redis clusters in two datacenters A and B,  A is master DC which all writes happen,
B is slave DC which just synchronize whole data set from A.

A1  <-----------stunnel--------- B1
A2  <-----------stunnel--------- B2
A3  <-----------stunnel--------- B3

In datacenter A I plan to use Redis sentinel for the three Redis instances A1/A2/A3,  one of them is Redis master,
two of them are Redis slaves.   In datacenter B all Redis instances are slaves.

I haven't verified it, according to Redis documentation,  when a failover in DC A happens,  Redis sentinel will
elect a slave to become master,  so it possibly selects a slave in DC B,  this is unexpected,  I expect
the slaveof relationship is fixed between A and B,  that's to say,  B_i  always tracks A_i.

How can I avoid Redis sentinel selecting slave in B?  by disabling slaveof command in B?

Another related question,  seems I can't use the "Redis Cluster" solution in DC A,  because B1/B2/B3 don't form
a "Redis Cluster"(they sync from A), the clients in DC B can't know the dynamically changing partition mapping,
is my guess right?

Regards,
Yubao Liu

Liu Yubao

unread,
Nov 28, 2013, 1:37:07 PM11/28/13
to redi...@googlegroups.com
Got help from huangz1990@github,  my use case can be achieved by those two settings in three Redis instances in datacenter B:

slave-priority 0
rename-command slaveof ""

With this setting, suppose A1 is master,  after kill A1 Redis sentinel will elect A2 or A3 as new master, won't elect B1/B2/B3,  and the slaveof setting of B1/B2/B3 won't be changed(this is expected, I want mirror a Redis cluster into another datacenter),  but Redis sentinel continuously reports this error message every 10 seconds:

+fix-slave-config slave 127.0.0.1:7379 127.0.0.1 7379 @ mymaster 127.0.0.1 6399

This is annoying because it will eat up my disk, any solution except patching Redis to allow this special kind of slave?

The configuration for the six Redis instances are almost same with default settings, except 6 different ports: A1 6379, A2 6389, A3 6399,  B1 7379, B2 7389, B3, 7399.  The master-slave relation is A2/A3/B1 follows A1,  B2 follows A2, B3 follows A3.

Regards,
Yubao Liu



--
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 http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/groups/opt_out.

Liu Yubao

unread,
Nov 28, 2013, 1:41:07 PM11/28/13
to redi...@googlegroups.com
I wouldn't like to enable dynamic slaveof change in data center B, because sooner or later Redis sentinel will make all slaves follows same master, in my use case, 5 slaves follow single master,  not maximum 3 slaves follow single master,  that may introduce high load on the Redis master.

Regards,
Yubao Liu

Reply all
Reply to author
Forward
0 new messages