Redis - Promoting a slave to master manually

前端 未结 3 1288
伪装坚强ぢ
伪装坚强ぢ 2021-02-19 08:02

Suppose I have [Slave IP Address] which is the slave of [Master IP Address].

Now my master server has been shut down, and I need to set this slave to be master MANUALLY

3条回答
  •  情深已故
    2021-02-19 08:19

    Is it possible doing this without restarting the redis service? (and losing all the cached data)


    yes that's possible, you can use
    SLAVEOF NO ONE (without sentinel)

    But it is recommended to use sentinel to avoid data loss.
    sentinel failover master-name(with sentinel)
    This will force the sentinel to switch master.
    The new master will have all the data that was synchronized before the old-master shutdown.
    Redis will automatically choose the best slave with max. data, that will reduce the amount of data we lose when switching master.

提交回复
热议问题