1. Copying
full resynchronization , full replication of data from the primary server from the server, primarily via RDB files and single commands (socket connections).
partial resynchronization , the master server when the command is propagated, not only will send the write command to the slave server, but also put the write command into the replication backlog buffer , when the master and slave server disconnects and reconnect, Send the Psync command from the server to the primary server (parameters include replication offset and server run ID) request synchronization, the primary server replies from the server based on the replication offset and the server run ID (only if the server runs the same ID as the primary server. The replication offset can be found in the replication backlog buffer for partial resynchronization.
2.Sentinel
Monitoring system, a high availability (HA) solution for Redis, consists of one or more sentinel instances that monitor all primary servers and their slave servers, and Sentinel selects one from the server from the offline primary server as the new primary server when the primary server is offline.
Sential sending messages to a channel via a command connection, receiving information from a channel via a subscription connection
Subjective downline: Sentinel sends a ping command to the server to get an invalid reply, Sentinel determines that the server is subjectively offline.
Objective offline: Sentinel to other connected to the subjective downline Server Sentinel inquiry, if the response results in the determination of the number of downline (including objective and subjective downline) to a certain extent to determine the objective of the server offline.
Select Lead Sentinel, select a new primary server
3. Cluster (Redis Cluster)
node: A node is a Redis server running in cluster mode and will continue to use all server components that are used in stand-alone mode. Each node uses the clusternode data structure to save its own state, and a corresponding Clusternode data structure is created for the other nodes to hold the state of the other nodes.
Slots: The entire database of the cluster is divided into 16,384 slots (slots), each node in the cluster can handle 0~16384 slots, when the 16,384 slots in the database have nodes in the processing, the cluster is on-line (OK), otherwise in the offline state (fail). The Clusternode structure records which slots are processed by the node, and the assignment information for the 16,384 slots is recorded in the clusterstate structure. CRC16 then modulo 16384 takes the remainder to calculate which slot the key belongs to.
For Redis cluster technology: client Shard, Proxy shard (twemproxy)
Multi-machine database of Redis learning notes