2 Node Redis HA

I have two nodes that I want to start as servers in active active mode, and also have HA capability, that is, if one of them is turned off, the other should start receiving all requests, but while both of them work, both should accept all requests. Now, since Redis does not allow active active mode for the same set of hashes, and I don’t have the ability to run Sentinel, since I cannot have a third node, my idea is to run two nodes in replication and decide if the node wizard is turned off and promotes the slave. Are there any problems with this? When the original master returns, is there a way to configure it as a subordinate?

Does that sound like a good idea? I am open to suggestions other than Radish.

+7
database redis hiredis
source share
3 answers

Ok, partial solution with SLAVEOF :

You can manually promote the slave in master by doing:

SLAVEOF NO ONE 

You can manually switch master to slave by doing:

 SLAVEOF <HOST> <port> 

Clustering must be disabled.

+2
source share

Usually launching two nodes is never a good idea, because it should have a split-brain problem: when the network between two nodes does not work for a minute or two, two nodes will inevitably think that each other is offline and will promote / keep yourself a host and start accepting requests from other services. Then a fragmented brain occurs.

And if everything is okay with this possible situation, you can study the master-slave setting using a script file and an HA service, such as a pacemaker or keepalived.

Typically, you should tell the cluster manager through a predefined rule that when two machines join a split state of the brain, which one is your preferred master.

When the wizard is selected, execute the script and basically run slaveof no one yourself and execute slaveof <new-master-ip> <port> on another node.

You can take one more step in your script file and try to combine the two data sets together, but whether this is achievable or not depends entirely on how you arranged your data in Redis and how long you are ready to wait for all data to synchronize.

I did it myself before going through a pacemaker + corosync.

+1
source share

I would recommend having at least 3 nodes with Sentinel Setup to enable gossip / quorum for automatically sending the slave if the current node wizard does not work.

0
source share

All Articles