Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do a redis FLUSHALL without initiating a sentinel failover?

We have a redis configuration with two redis servers. We also have 3 sentinels to monitor the two instances and initiate a fail over when needed.

We currently have a process where we periodically have to do a FLUSHALL on the redis server. This is a blocking operation that takes longer than the time we have allotted for the sentinels to timeout. In other words, we have our sentinel configuration with:

sentinel down-after-milliseconds OurMasterName 5000

and doing a redis-cli FLUSHALL on the server takes > 5000 milliseconds, so the sentinels initiate a fail over.

We acknowledge that doing a FLUSHALL isn't great and we also know that we could increase the down-after-milliseconds to but for the purposes of this question assume that neither of these are options.

The question is: how can we do a FLUSHALL (or equivalent operation) WITHOUT having our sentinels initiate a fail over due to the FLUSHALL blocking for greater than 5000 milliseconds? Has anyone encountered and solved this problem?

like image 606
jakejgordon Avatar asked Oct 08 '15 18:10

jakejgordon


People also ask

Should I use Redis Sentinel or cluster?

If you need an automatic failover solution without going to a complete cluster solution, use Sentinel. To get a complete cluster solution that splits your database between multiple nodes, then go for clustering.

How do I stop Redis Sentinel?

Stopping the Redis Server If you started the Redis server using the redis-server command, you could stop the Redis server by pressing CTRL + C.

What does Flushall do in Redis?

Redis Commands The FLUSHDB command deletes the keys in a database. And the FLUSHALL command deletes all keys in all databases.

How does Redis failover work?

In case of a failure in your Redis cluster, Sentinel will automatically detect the point of failure and bring the cluster back to stable mode without any human intervention. In other words, Redis Sentinel is a system that can resist Redis deployment without human intervention.


1 Answers

You could just create new instances: if you are using something like AWS or Azure than you have API for creating a new Redis cluster. Start it, load it with data and once ready just modify the DNS, again with API call -so all these can be handled by some part of your application. But on premises things can get more complex because it will require some automation with ansible/chef/puppet.

like image 154
Liviu Costea Avatar answered Nov 05 '22 20:11

Liviu Costea