redis Middleware

redis clusters:
Cluster policy:
main (synchronous obtained from the library from the main library data does not itself provide services) from the copy
Sentinel (monitoring the main library and from the library, when the main library linked automatically from the library to choose a switch-based library, master inventory put the full amount of data)
cluster
reference: https: //blog.csdn.net/q649381130/article/details/79931791,https: //blog.csdn.net/c295477887/article/details/52487621

Cluster principle:

redis cluster in the design, to take into account to the center, to the middleware, that is, each node in the cluster are equal relationship are peers, each node keeps their data and entire the state of the cluster. Each node and all other nodes are connected, and these connections remain active, thus ensuring that we only need to connect any node in the cluster, you can get the data to other nodes.

Redis cluster is not used and a conventional data consistent hashing to assign, instead of using additional grooves called hash (hash slot) assigned to. redis cluster 16384 slot allocated by default, when we set a key, will use CRC16 algorithm modulo obtain slot belongs, then the node key assigned to the hash slot interval, the specific algorithm is: CRC16 (key) % 16384. So we see that at the time of the test set and get the time to jump directly to the node 7000 port.

Redis cluster data will present a master node, then the data synchronization between the master and its corresponding salve. When reading data, also corresponding to the master node acquires data according to a consistent hashing algorithm. After only hang up when a master, will start a salve nodes corresponding to serve as master.

Note that: You must be three or more primary nodes, or when creating a cluster fail, and when the survival of the main nodes less than half of the total number of nodes, the entire cluster will not be able to provide the service.

 

Cluster is divided into the following:
Client fragmentation
fragmentation agent-based
routing queries
Reference: https: //www.jianshu.com/p/14835303b07e

Guess you like

Origin www.cnblogs.com/ljy-skill/p/11111564.html