Interview Series 17 redis cluster


1, redis cluster Introduction

redis cluster

(1) Automatic data fragmentation, the discharge portion of the data on each master
(2) to provide built-in support for high availability, the partial master is unavailable, or continue to work

In redis cluster architecture, each redis to open two port numbers, for example, is a 6379, is to add another port number 10000, for example 16379

16379 is the port number used for inter-node communication, which is the cluster bus thing, cluster bus. cluster bus communication, used for fault detection, configuration update authorization failover

another cluster bus with the binary protocol used for efficient exchange of data between the nodes, use less network bandwidth and processing time

2, the most old-fashioned and drawbacks of hash algorithm (a lot of caching reconstruction)

3, consistent hash algorithm (automatic cache migration) + virtual node (automatic load balancing)

4, redis cluster algorithm of hash slot

redis cluster have fixed 16384 hash slot, calculates CRC16 value for each key, and then modulo 16384, may obtain a corresponding key hash slot

redis cluster in each master will hold part of the slot, for example, there are three master, then the master may each hold more than 5000 hash slot

hash slot allows adding and removing node is simple, add a master, will hash slot moving some of the other master of the past, reducing a master, it will be moved to another master hash slot up

The cost of mobile hash slot is very low

api client can specify the data, let them go with a hash slot, implemented by hash tag

Guess you like

Origin www.cnblogs.com/xiufengchen/p/11259121.html