In Redis, you may sometimes need to promote a slave to a master for various reasons, such as implementing a failover mechanism in case the existing master node fails. Here's how you would do it:
SLAVEOF NO ONE command. In the Redis CLI, this looks like:
This command effectively makes the current slave server a master.
Please note that forcing a slave to act as a master should generally only be done when the master is permanently unavailable or during maintenance tasks. Doing so in other cases might lead to inconsistent states across your Redis servers.
Also understand that if the original master comes back online, it will not automatically start acting as a slave of the new master. If you want to set up a new master-slave relationship, you'll have to manually configure that using the
SLAVEOF command again.