Redis cluster (2 Master & 2 slave configuration)

1,052 views
Skip to first unread message

Raju Rh

unread,
Mar 23, 2016, 2:35:58 AM3/23/16
to Redis DB
I am trying to setup a redis cluster on Windows machine. So basically i have 2 master servers where i have distributed slots in between them i.e. 1 will have from slots from 0-8191 and another one from 8192-16383. Both this master have corresponding slave for replication & both the masters are in running mode and in each servers i am able to see both the nodes by using CLUSTER NODES command. So basically all 4 servers (2 master and 2 slaves are interconnected in Cluster)

Using cluster meet command i have joined the servers and using cluster info i am able to see the cluster state as OK. 

So now my question is during fail over of master the slave should be promoted as master otherwise the cluster state says CLUSTER DOWN and not able to retrieve data.

Using the below command I am making it as failover for one of the master.
redis-cli -h node2 debug segfault 

Since master is down not able to get the data and cluster status says its down. So please advise or suggest what approach can be followed when one of the master is down still able to retrieve the data and cluster state should be OK.

One approach i am thinking is of Using Sentinel approach but not sure it works or not. Any ideas or suggestion are most welcome here.


Jan-Erik Rediger

unread,
Mar 23, 2016, 5:36:44 AM3/23/16
to redi...@googlegroups.com
Use at least 3 masters. You need a majority of masters still be alive to
initiate the failover.

On Tue, Mar 22, 2016 at 11:35:58PM -0700, Raju Rh wrote:
> I am trying to setup a redis cluster on Windows machine. So basically i
> have 2 master servers where i have distributed slots in between them i.e. 1
> will have from slots from 0-8191 and another one from 8192-16383. Both this
> master have corresponding slave for replication & both the masters are in
> running mode and in each servers i am able to see both the nodes by using
> CLUSTER NODES command. So basically all 4 servers (2 master and 2 slaves
> are interconnected in Cluster)
>
> Using cluster meet command i have joined the servers and using cluster info
> i am able to see the cluster state as OK.
>
> *So now my question is during fail over of master the slave should be
> promoted as master otherwise the cluster state says CLUSTER DOWN and not
> able to retrieve data.*
>
> Using the below command I am making it as failover for one of the master.
> redis-cli -h node2 debug segfault
>
> Since master is down not able to get the data and cluster status says its
> down. So please advise or suggest what approach can be followed when one of
> the master is down still able to retrieve the data and cluster state should
> be OK.
>
> One approach i am thinking is of Using Sentinel approach but not sure it
> works or not. Any ideas or suggestion are most welcome here.
>
>
> --
> 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.

Tuco

unread,
Mar 24, 2016, 10:51:58 PM3/24/16
to Redis DB
You should have the following running in cluster.
Host1: master 1 and slave 2.
Host2: master 2 and slave 1.

That ways, if one of your hosts goes down, a failover will start automatically.

AlexanderB

unread,
Mar 28, 2016, 5:01:01 PM3/28/16
to Redis DB
Tuco, you'll run into some painful issue with that sort of a setup. 

If the network connection between Host1, and Host2 has any issues, but both hosts themselves are running fine, you get a split brain scenario. 
From Host1's point of view, Host2 is down, so it promotes it's slave. 
From Host2's point of view though, Host 1 is down, so it also promotes it's slave. 
When the network connection starts responding suddenly you have 2 full clusters connected to each other. 

This is why the recommendation is to always use an odd number of masters and use (number of master / 2) + 1 as the quorum. 
That makes it impossible for two halves of a cluster to both act independently in such a sense. There's no way to split a 3 master cluster into two autonomous 2 master halves. 
Reply all
Reply to author
Forward
0 new messages