Redis cluster (i): Basic concepts

Source: Internet
Author: User
Tags redis cluster


First, use version: 3.0.0.0
Second, the basic concept:
  1. a Redis cluster is one that can data sharing across multiple Redis nodes facilities (installation).
  2. Redis clusters are implemented using data sharding (sharding) instead of a consistent hash (consistency hashing): A Redis cluster contains 16,384 hash slots (hash slots), and each key in the database belongs to one of these 16,384 hash slots , the cluster uses the formula CRC16 (key)% 16384来 to calculate which slot the key key belongs to, where the CRC16 (key) statement is used to calculate the CRC16 checksum of key keys
  3. Each node in the cluster is responsible for processing a portion of the hash slot. For example, a cluster can have three hash slots, where:
      1. Node A is responsible for handling hash slots No. 0 to No. 5500.
      2. Node B is responsible for processing No. 5501 to 11,000th hash slots.
      3. Node C is responsible for handling hash slots 11,001th to 16,384th.
  4. Addition and removal of nodes
      1. If the user adds the new node D to the cluster, the cluster simply moves some slots in node A, B, and C to node D.
      2. If the user wants to remove node A from the cluster, the cluster needs only to move all the hash slots in node A to node B and node C, and then remove the empty (without any hash slots) Node A.
  5. The function of master-slave node
    1. if the cluster is created (or at least before node B is offline), weMaster Node B adds the B1 from the node, then when the primary node B is down, the cluster will set the B1 to the new master nodeand Let it take the place of the main node B of the downline and continue processing5501number to11000hash slot so that the cluster does not function properly due to the downline of the primary node B.
  6. Asynchronous replication (although asynchronous replication, but execution of write commands and copy commands to the slave node is performed almost simultaneously, so the data is generally not lost)
      1. The client sends a write command to master node B.
      2. Master node B executes the Write command and returns a command reply to the client.
      3. Master Node B copies the write command just executed to its slave nodes B1, B2, and B3.


Iii. References:Http://redisdoc.com/topic/cluster-tutorial.html http://www.redis.net.cn/http://redis.io/


From for notes (Wiz)

Redis cluster (i): Basic concepts

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.