• notice
  • Congratulations on the launch of the Sought Tech site

Don't mess around with Redis clusters, this is the correct posture!

Author: Harmonica that can't wait
Link: https://www.cnblogs.com/Courage129/p/14344151.html

When we build a cluster, we must first understand what problems need to be solved.Before figuring out this, think about the problems of a single node, a single entity, and a single machine?

  • Single point of failure
  • Limited capacity
  • Limited connections supported (insufficient performance)
  • ......

In order to solve these problems, we need to cluster the servers, and how do we expand the servers?

Introduce a concept here, one of the principles of microservice design-AKF principle

AKF of the principle of microservice splitting

First of all, let's look at the problem of single point of failure of a single node.Since a single node is easy to hang, it can be replicated.One more, three concepts are designed here, master-slave, master-master , master and backup, there are also three ways.In simple terms, master and master are equivalent to multiple servers providing read and write to the outside world at the same time:

Master-slave, the host can read and write, but generally only provides external writing, and the slave provides external reading:

Main and standby, the host provides read and write, and the standby machine does not provide external services.When the host is hung up, the standby machine elects the host to provide external services.

X-axis split

It can be seen that these kinds of splitting a machine can be regarded as a mirror image of another machine, basically with full data, this splitting mode is one of the AKF splitting modes:X-axis Split

The above picture is a schematic diagram of AKF split.In order to solve a single point of failure, we have several machines with full data for backup, such as the main-active, main-standby, etc.mentioned earlier.The characteristic is that any two machines contain similar data., one can be regarded as the mirror image of the other,

Y-axis split

At this time, there are new problems.For example, in a server, some functions may be frequently accessed, the data involved are frequently read and written, and other data are basically not accessed very much.At this time, this part of the data can be isolated.That is to continue to split the server according to the function and business, this kind of disassembly is the Y-axis split

in AFK

The characteristic is that different Redis are responsible for different functions when viewed vertically on the Y-axis, that is, the data contained are also different.In addition, if only one business server on the Y-axis is extended, there may be single-point problems.So you can combine AFK's X-axis splitting principle, continue to split the X-axis of the points on the Y-axis just split,

Z-axis split

After the XY splitting of the above AFK principle, the server shows that the master-slave master-slave replication is performed, and then the business is split.Different Redis is responsible for different business requests.At this time, there will be a new problem.For example, for a Redis on the Y-axis, it is responsible for a certain business, but the data access of this business is huge today, so the data request has to be AFK's Z-axis split, for example, first Analyze the data request situation, and then divide it into Beijing and Shanghai according to the source of access, so that although different Redis is responsible for different data, but the responsible business is the same, AFK split diagram:

AFK Summary

X-axis splitting: horizontal replication, that is to say, a single system runs several more entities, in a cluster plus load balancing mode, master-master, master-standby, master-slave,

Y-axis split: based on different business splits

Z-axis split: split based on data,

Recent hot text recommendation:

1.1,000+ Java interview questions and answers (2022 latest version)

2.Madden! Java coroutines are coming,,,

3.Spring Boot 2.x tutorial, so complete!

4.Spring Boot 2.6 is officially released, a wave of new features,,

5."Java Development Manual (Songshan Edition)" is the latest release, download it quickly!

If you think it's good, don't forget to like + retweet!


Technical otaku

Sought technology together

Related Topic


Leave a Reply