CAP theorem
The final consistency
Synchronization mechanisms provided by Redis
-
Master-slave synchronization
-
Clumps synchronization master node relieve stress
Synchronous mode of Redis
-
Incremental synchronization
-
Redis synchronization instruction flow, annular flow Buffer store instruction
-
Disadvantage: buffer size is fixed, there will be a case where the instruction is not executed is overwritten
-
-
Snapshot synchronization
-
Resource-intensive, the master node Bgsave to disk file, then the contents of the file transferred from the node
-
During the snapshot file from the node after receiving the full amount of the load is complete, delete the current data memory before loading, after the record is complete continue incremental synchronization
-
-
You need a reasonable set buffer size, to avoid an endless loop synchronous snapshots
-
Increase from the node
After the first to conduct a full amount of snapshot synchronization, then the next incremental synchronization
Diskless Copy
Snapshot shortcomings synchronization: bring a lot of resource consumption, especially for non-SSD disk storage, it will lead to greater system load.
The master node transmits the snapshot of the content directly through socket communication to the slave node, the master node while traversing the memory from the side transmitting the content to the node.
Content recorded from the node, then the disposable loading into memory.
wait instruction
Redis synchronous asynchronous replication, may be used to force wait instruction using synchronous replication. But once the network partitioning occurs, it will result in Redis unavailable