It is unclear to me from the documentation on replication whether the SYNC command is blocking.
It seems like it shouldn't be (after all, spinning up a new slave would stop the master from serving requests), but I'd like confirmation of that.
For context, I'm looking at adding a slave to a master hosting about 8GB of data with no disk sync*.
*Historically, data loss has not been a concern. We're changing that, so replication and persistence are bein开发者_如何转开发g "back ported" to a degree.
the master will just perform a BGSAVE on SYNC request from the slave, so it's not a blocking operation.
So the sequence is:
- slave asks for SYNC
- master BGSAVE, slave waits
- master BGSAVE finished, the initial bulk data (the .rdb file) is transfered to slave
- master accumulates all the new differences for the slave
- master finishes sending the whole initial rdb file to slave
- master start feeding the slave with the accumulated buffer, and with anything new arriving from clients, if they are writes.
It also works if the master is not configured to save, simply it will produce an .rdb just for master <-> slave synchronization. In master instances configured without "save" lines in redis.conf BGSAVE is not called automatically, but can still be called by the user if there is the need to save an .rdb file.
精彩评论