English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis SLAVEOF Command

Redis Server

The Redis SLAVEOF command can turn the current server into a slave server of the specified server.

If the current server is already a slave server of a master server, executing SLAVEOF host port will make the current server stop synchronizing with the old master server, discard the old dataset, and start synchronizing with the new master server.

Additionally, executing the command SLAVEOF NO ONE on a slave server will disable the replication feature of this slave server and change it back to a master server from a slave server, and the synchronized dataset will not be discarded.

Using the feature of 'SLAVEOF NO ONE will not discard the synchronized dataset', you can use the slave server as a new master server when the master server fails, thus achieving uninterrupted operation.

Syntax

Basic Syntax of Redis SLAVEOF Command:

redis 127.0.0.1:6379> SLAVEOF host port

Available Version

>= 1.0.0

Return Value

Always returns OK .

Online Examples

redis 127.0.0.1:6379> SLAVEOF 127.0.0.1 6379
OK
redis 127.0.0.1:6379> SLAVEOF NO ONE
OK

 

Redis Server