In a Redis cluster, do you choose odd or even nodes? (theory)
Let's analyze it through a set of examples:
3-node environment: 1 master, 2 slave
Storage space: maximum equal to the capacity of 1 node. (if it is 2 master, then part of the data will be lost)
Redundancy: 1 node failure is allowed.
4-node environment: 2 master, 2 slave
Storage space: the capacity of 2 nodes.
Redundancy: 1 node failure is allowed. (more than half of the nodes in the cluster will be elected only if they think it is a failure. )
5-node environment: 2 master, 3 slave
Storage space: the capacity of 2 nodes.
Redundancy: allows 2 node failures.
6-node environment: 3 master, 3 slave
Storage space: the capacity of 3 nodes.
Redundancy: allows 2 node failures.
And so on.
Comparison of 3 nodes and 4 nodes:
Capacity: the latter has an extra storage space of 1 node.
Redundancy: all allow 1 node failure.
Comparison of 4 nodes and 5 nodes:
Capacity: both are the capacity of 2 nodes.
Redundancy: the latter has 1 more node redundancy.
By comparison, it is found that whether the redis cluster chooses odd nodes or even nodes depends on the needs of the business.
For example: the total amount of data of the business can be met by 2 nodes, then it depends on the requirements of the business for redundancy.
If you have 1 redundancy on OK, then consider a cluster of 4 nodes.
If you want more redundancy, consider a cluster of five nodes.
But then again, since the enterprise has chosen the redis cluster, the company is not short of the money of this node.
The general practice is an even-numbered redis cluster.