HA in Redis when one node crashes

29 views
Skip to first unread message

Akshat Tandon

unread,
Feb 12, 2018, 10:25:04 AM2/12/18
to Redis DB
Hi All, 

While working on Redis HA Use Cases We came across one use where master node crashes i.e 
We have a 3 node Redis Cluster , One master , 2 Slaves Connected through Sentinel Configuration. 

redis-cluster ├── node1 ( MASTER ) │ ├── redis.conf │ └── sentinel.conf ├── node2 . ( SLAVE 1 ) │ ├── redis.conf │ └── sentinel.conf └── node3 . ( SLAVE 2 ) ├── redis.conf └── sentinel.conf

This thing works well till the time we have same nodes in a cluster , But when one of our Redis nodes crashes or we are not able to recover say master node , Sentinel elects a new mater say node 2 

redis-cluster ├── node1 . ( Crashed ) │ ├── redis.conf │ └── sentinel.conf ├── node2 . ( New Master ) │ ├── redis.conf │ └── sentinel.conf └── node3 . ( Slave ) ├── redis.conf └── sentinel.conf


Now when we recover node1 ( or recreate new Node1 ) that node should be slave now , We have to add following lines in redis.conf , Else it is unable to join that cluster 

slaveof Node2 <node2-port> 

  • Is this what Redis  community recommends  ? 
or 
  • Is there any elegant way in Redis to achieve the same ? 
Thanks and Regards
Akshat Tandon


Salvatore Sanfilippo

unread,
Feb 12, 2018, 10:38:27 AM2/12/18
to redi...@googlegroups.com
Hello, if you wait a bit, Redis Sentinel should actually reconfigure
automatically the new node. Once the failover happens, if you check
the log, the original master is re-added as a slave in the logical
configuration of Sentinel. Later when it rejoins the cluster claiming
to be a slave, one of the Sentinels will convert it into a slave in a
(small) multiple of the node timeout time (down-after-milliseconds).
> --
> 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,
Feb 12, 2018, 11:17:43 AM2/12/18
to Redis DB
It's not a good idea to use the SLAVEOF parameter in the redis.conf file when the group of machines are controlled by Sentinel.  You don't want the Redis process to try to join the group as a master or slave of its own accord.  Instead, let Sentinel notice the process is back, connect to it and configure it.  Sentinel knows which master/slave role this recovered process should have, and if it's a slave, which other Redis is the master.

Your redis.conf file should have the configuration that allows Sentinel to connect to it and configure it.  (I.e., which ip address and port to listen on, which password - if any - Sentinel will use)
Reply all
Reply to author
Forward
0 new messages