Redis builds a fragmented cluster

Redis builds a fragmented cluster

  1. A total of 6 redis, three masters and three slaves, create directories respectively, 7001, 6002, 7003, 8001, 8002, 8003
    insert image description here
  2. Configure the message in the configuration file in the respective directory, modify the corresponding file directory, and start 6 redis services after configuration
    insert image description here
  3. Configure cluster
    insert image description here
    4. View cluster status
redis-cli -p 7001 cluster nodes
  1. Cluster connection redis
redis-cli -c -p 7001
  1. Hash slot
    Redis will map each master node to 0-16384 slots. The data key is not bound to the node, but to the slot. It will hash according to the key and take the remainder with 16384. as a slot value.
    As shown below, when accessing node 7003, if the slot of a is at 7003, it can be obtained at node 7003, and the slot of num at 7002 will be redirected to 7002
    insert image description here

Guess you like

Origin blog.csdn.net/hcyxsh/article/details/131362373