Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis Cluster not promoting Slave to master when master fails

Tags:

redis

I am running a 4 node REDIS CLUSTER on a Windows 2012 box.

My set up is 1 Master and 3 Slaves. When I end the Master Service via the Services component, none of my slaves autopromote themselves to master. How do I get the Slaves to recognize a Master is failing and have them promote as soon as they see the failure. Below is my Redis Config. This is the same Config file for all nodes, the only difference is the port is changed for each node

port 30002 cluster-enabled yes cluster-config-file nodes.conf appendonly yes loglevel notice logfile "log" syslog-enabled yes syslog-ident redis maxmemory 200mb maxmemory-policy volatile-ttl

Edit

What other information do I need to supply to make this easier to help fix.

Edit 2

My end game is a redis cluster , I want this Cluster to have 1 master and 3 slaves. The reason why I want a cluster over a setup with 1 Master and 3 slaves is, I want to avoid installing REDIS Sentinel. I want the cluster to promote the slaves to masters and not redis sentinel doing that.

My Install process is as follows

  • Create 4 folders (A,B,C,D)
  • In each folder copy the REDIS 64 msi for windows
  • In folder A,B,C,D put in a config file just like the one above but different ports
  • Install redis service using folders A,B,C,D
  • Start all services
  • Do Redis Meetup for folders A,B,C,D
  • Add replication for folder A over to folder B,C,D
  • Assign all keys to redis instance on folder A

voila cluster setup with with FOLDER A being the master and B,C,D being slaves of A. Now the only problem is, when A goes down none of the slaves (B,C,D) auto promote.

EDIT

redis.conf file of the master

port 30001 cluster-enabled yes cluster-config-file nodes.conf appendonly yes loglevel notice logfile "log" syslog-enabled yes syslog-ident redis maxmemory 200mb maxmemory-policy volatile-ttl

ouput of cluster nodes before i run sc stop redismasteralpha

05a73c800cccfd8b11d33232887570c52a326afe 10.144.62.3:30002 slave 20be3e69195744aa379124d19a836650c72c23ba 0 1478637832268 5 connected
20be3e69195744aa379124d19a836650c72c23ba 10.144.62.3:30001 master - 0 1478637837736 5 connected 0-16383
d60d3d0a9f12ef37c997fe44389996d8c7f19c2c 10.144.62.3:30000 myself,slave 20be3e69195744aa379124d19a836650c72c23ba 0 0 1 connected
fda22db5ed5d25e2a8fba82122b47818fba248ce 10.144.62.3:30003 slave 20be3e69195744aa379124d19a836650c72c23ba 0 1478637836644 5 connected

after stopping the service

05a73c800cccfd8b11d33232887570c52a326afe 10.144.62.3:30002 myself,slave 20be3e69195744aa379124d19a836650c72c23ba 0 0 3 connected
d60d3d0a9f12ef37c997fe44389996d8c7f19c2c 10.144.62.3:30000 slave,fail 20be3e69195744aa379124d19a836650c72c23ba 1478637948956 1478637947808 5 disconnected
fda22db5ed5d25e2a8fba82122b47818fba248ce 10.144.62.3:30003 slave 20be3e69195744aa379124d19a836650c72c23ba 0 1478638078833 5 connected
20be3e69195744aa379124d19a836650c72c23ba 10.144.62.3:30001 master,fail? - 1478638034799 1478638031628 5 connected 0-16383

And the master,fail state will not change no matter how long I wait

cluster info after service is stopped

cluster_state:fail

cluster_slots_assigned:16384

cluster_slots_ok:0

cluster_slots_pfail:16384

cluster_slots_fail:0

cluster_known_nodes:4

cluster_size:1

cluster_current_epoch:5

cluster_my_epoch:5

cluster_stats_messages_sent:1075189

cluster_stats_messages_received:930887

like image 617
gh9 Avatar asked Oct 17 '22 23:10

gh9


1 Answers

As far as I know, redis cluster will not work with less than 3 masters.

Take a look at this note on redis cluster tutorial:

Note that the minimal cluster that works as expected requires to contain at least three master nodes. For your first tests it is strongly suggested to start a six nodes cluster with three masters and three slaves.

like image 190
thepirat000 Avatar answered Oct 21 '22 05:10

thepirat000