Redis - manual slave promotion

Suppose I have a [slave IP address], which is a slave device [Master IP Address].

Now my main server was disconnected, and I need to install this slave as a MANUALLY master (WITHOUT using automatic failover, with the redis command).

Is it possible to do this without restarting the redis service? (and loss of all cached data)

+8
source share
3 answers

use SLAVEOF NO ONE to promote a slave

http://redis.io/commands/slaveof

+17
source

It depends, if you are in a cluster, you better use a failure. You will need to use the force parameter in the command

http://redis.io/commands/cluster-failover

+2
source

Is it possible to do this without restarting the redis service? (as well as the loss of all cached data)


yes it is possible you can use
SLAVEOF NO ONE (without guard)

But it is recommended to use a sentinel to avoid data loss.
sentinel failover master-name (with guard)
This will force the guard to change the owner.
The new master will have all the data that was synchronized before turning off the old master.
Redis will automatically select the best slave with max. data that will reduce the amount of data that we lose when switching the wizard.

0
source

Source: https://habr.com/ru/post/1237650/


All Articles