Sentinel
Codis
Replication
This system works using three main mechanisms:
When a master and a slave instances are well-connected, the master keeps the slave updated by sending a stream of commands to the slave, in order to replicate the effects on the dataset happening in the master side due to: client writes, keys expired or evicted, any other action changing the master dataset.
When the link between the master and the slave breaks, for network issues or because a timeout is sensed in the master or the slave, the slave reconnects and attempts to proceed with a partial resynchronization: it means that it will try to just obtain the part of the stream of commands it missed during the disconnection.
When a partial resynchronization is not possible, the slave will ask for a full resynchronization. This will involve a more complex process in which the master needs to create a snapshot of all its data, send it to the slave, and then continue sending the stream of commands as the dataset changes.
Reference
- [Redis Sentinel Documentation] https://redis.io/topics/sentinel
- [Replication] https://redis.io/topics/replication
- [为什么大厂都喜欢用 Codis 来管理分布式集群?] https://juejin.im/post/5c132b076fb9a04a08218eef