YouTip LogoYouTip

Server Slaveof

Redis Slaveof Command | Novice Tutorial

Novice Tutorial -- Learning Not Just Technology, But Dreams!

Redis Tutorial Redis TutorialRedis IntroductionRedis InstallationRedis ConfigurationRedis Data Types

Redis Commands

Redis CommandsRedis KeyRedis StringRedis HashRedis ListRedis SetRedis Sorted SetRedis HyperLogLogRedis Publish SubscribeRedis TransactionsRedis ScriptingRedis ConnectionRedis ServerRedis GEORedis Stream

Redis Advanced Tutorial

Redis Data Backup and RecoveryRedis SecurityRedis Performance TestingRedis Client ConnectionRedis PipeliningRedis PartitioningJava Using RedisPHP Using Redis Redis Shutdown CommandRedis Shutdown Command Redis Slowlog CommandRedis Slowlog Command In-depth Exploration Script Language Data Management Scripts Programming Computer Servers Networking Programming Languages Network Services Search Web Service

Redis Slaveof Command

Redis Server The Redis Slaveof command can transform the current server into a slave server of the specified server. If the current server is already a slave server of some master server, executing SLAVEOF host port will cause the current server to 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 function and transform the slave server back to a master server, without discarding the originally synchronized dataset. By utilizing the feature that 'SLAVEOF NO ONE does not discard the synchronized dataset', you can use the slave server as a new master server when the master server fails, thereby achieving uninterrupted operation.

Syntax

The basic syntax of the redis Slaveof command is as follows: redis 127.0.0.1:6379> SLAVEOF host port

Available Version

>= 1.0.0

Return Value

Always returns OK.

Example

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
← Server Client PauseServer Shutdown β†’