redis clusters understanding

Redis 3.0 also introduces the concept of the cluster, to solve some of the large amount of data and high availability problem, however, in order to achieve high performance purposes, the cluster is not strong consistency, using asynchronous replication , the data to the host after the node, the master node returns a success, the data is copied from the node to asynchronously.

For Redis cluster fragmentation mechanism. Redis using CRC16 (key) mod 16384 fragmentation, was divided into slots 16384 hashes, such as if the cluster has three nodes, we assign hash slot according the following rules:

  • A node contains a hash of the groove 0-5500;

  • Node-B contains a hash of the groove 5500-11000;

  • Node 11 comprises a C

 

 

 

FIG Redis There are three replicate master node from the server, wherein between any two nodes are interconnected, the client may be connected to either one of the nodes, and access any node in the cluster, its deposit and take other actions.

That Redis is how to do it? First, each node will store the hash of Redis groove information, we can understand it as a variable can store two values, the variable is in the range 0-16383. Based on this information, we can find each node is responsible for the hash slot, and then locate the node where the data resides.

Redis cluster is actually a cluster management plug-in, when we provide access to a keyword, they will come to this conclusion based on CRC16 algorithm, and then divide the result by the number 16384 remainder, so each keyword corresponds to a 0-16383 hash slot number to find a corresponding node through the slot corresponding to this value, and then automatically jump directly to the corresponding node access operation. But these are implemented by the internal mechanism of the cluster, we do not need to manually implement

 

Guess you like

Origin www.cnblogs.com/chaiming520/p/10943094.html