当前位置:网站首页>Redis cluster configuration

Redis cluster configuration

2022-06-10 21:12:00 Fly link

One 、 Introduce

  • Redis The cluster has realized to Redis Horizontal expansion of , Start now N individual redis node , The entire database is distributed and stored here N A node in the , Each node stores the total data 1/N
  • Redis Clusters are partitioned (partition) To provide a certain degree of usability (availability): Even if some nodes in the cluster fail or fail to communicate , The cluster can also continue to process command requests
  • Redis Adopt non centralized cluster configuration

Two 、 Cluster node allocation principle

  • A cluster must have at least 3 Nodes
  • Options ``–cluster-replicas 1` Indicates that each master node in the cluster creates a slave node
  • The allocation principle tries to ensure that each master database runs on different servers IP Address , Each slave library and master library are not in one IP Address

3、 ... and 、slot

  • One Redis The cluster contains 16384 Slots (hash slot), Every key in the database belongs here 16384 One of the slots , The cluster uses the formula CRC16(key) % 16384 To calculate the key key Which slot does it belong to , among CRC16(key) Statements are used to evaluate keys key Of CRC16 The checksum .
  • Each node in the cluster is responsible for processing a portion of the slots . for instance , If a cluster can have a master node , among :
    • node A Responsible for handling 0 No. to 5460 Slot number .
    • node B Responsible for handling 5461 No. to 10922 Slot number .
    • node C Responsible for handling 10923 No. to 16383 Slot number .

3、 ... and 、 advantage

  • Realize capacity expansion
  • Apportionment pressure
  • No central configuration is relatively simple

Four 、 shortcoming

  • Multi key operation is not supported
  • Multibond Redis Transactions are not supported ,lus Scripts are not supported
  • Due to the late emergence of the cluster scheme , Many companies have adopted other clustering schemes , The proxy or client partition scheme wants to migrate to redis cluster, Need overall migration rather than gradual transition , High complexity
原网站

版权声明
本文为[Fly link]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206101955333349.html