Author: Antirez Weblog
As I wrote in a previous blog post, I am currently developing some of the resynchronization features of Redis slave.
Our idea is that we have a backup log of the replication stream that can reach the specified number of bytes (by default it will be hundreds of megabytes).
If a slave connection is lost, it will establish a connection again, see if the master's Runid is the same, and ask to continue from a given offset. If replication is likely to continue, there is no loss, and full resynchronization is not necessary. Otherwise, if the data offset does not exist in the fallback log, a full resynchronization will occur.
Now interestingly, in order to do this, both slave and master must know a global copy offset.
Now, if we provide a command to return this offset, the client can simply simulate synchronous replication by sending a query command, get the offset (think about how multi/exec does it), and do the same thing to slave. Because Redis replicates only very low latency, the client can simply do an optimistic "write, read offset, read slave offset" ("Write, Read-offset, Read-offset-on-slave"), And the offset read from the slave is probably ready to continue (or we'll read it again after a pause).
It might be useful, but I don't know if we can build something better from that, we're sending a redis command that, as long as we don't get an acknowledgment of the read-replica offset from at least n connected slave, we block and return the time and +ok that occurred.
When we understand whether this is useful and its complexity, I am not sure whether it is available, but from a preliminary analysis, to achieve fast and reliable ... It may not be important, it sounds good.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.