w3resource

Redis Server: SYNC

Redis SYNC Command

Redis SYNC command is used to sync slave to master.

Here are some common uses and scenarios for the "SYNC" command:

  • Replication Initialization: Initiates the process of synchronizing data between a master and a replica (slave) server, ensuring the replica has an up-to-date copy of the master’s dataset.
  • Data Transfer: Facilitates the transfer of the current dataset from the master to the replica during replication setup or when a replica reconnects after a failure.
  • Consistency Restoration: Helps restore consistency between master and replica servers by initiating a full data synchronization.
  • Testing: Useful for testing replication and failover scenarios by manually triggering data synchronization.

Syntax:

SYNC

Available since

1.0.0.

Return Value

Simple string reply

Return Value Type

String

Example: Redis SYNC

redis 127.0.0.1:6379> SYNC 
Entering slave output mode...  (press Ctrl-C to quit)
SYNC with master, discarding 18 bytes of bulk transfer...
SYNC done. Logging commands from master.
"PING"
"PING"
"PING"
"PING"

Previous: SLOWLOG
Next: TIME



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/redis/redis-server-sync.php