Redis - Promoting a slave to master manually

前端 未结 3 1286
伪装坚强ぢ
伪装坚强ぢ 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.

    0 讨论(0)
  • 2021-02-19 08:33

    use SLAVEOF NO ONE to promote a slave to master

    http://redis.io/commands/slaveof

    0 讨论(0)
  • 2021-02-19 08:34

    it depends, if you are in a cluster you will be better using the fail over. You will need to use the force option in the command

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

    0 讨论(0)
提交回复
热议问题