简体   繁体   中英

Redis replication order

In a master-slave scenario, Redis replication is made in an asynchronous way. But is it guaranteed that the commands are replicated in order? If I have these commands:

SET key1 111
SET key2 222
SET key3 333

If the slave node has "key2", then I can say for sure that it'll also have "key1"?

Yes, commands are replicated in order. Anything else wouldn't actually be replication.

As described in the documentation , both the master and the replica keep track of an offset indicating where they are in the stream of commands. That allows the replica to know if it receives a command out of order and not process it prematurely.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM