A Redis Cluster requires a minimum of six nodes for it to operate correctly. This configuration includes three master nodes and three corresponding slave nodes, one for each master.
The reason for this setup is due to how Redis Cluster handles its failover mechanism. When a master node fails, an automatic failover process begins in which the slaves vote whether to promote one of themselves as the new master. To prevent "split-brain" scenarios where two parts of the network think they are authoritative, a majority of master nodes (at least 2 out of 3 in the case of the minimal configuration) must be able to communicate with each other and agree on the state of the network.
Here's an example of how you might start up a minimal Redis cluster:
In these commands,
--cluster-enabled yes enables cluster mode,
--cluster-config-file nodes-xxxx.conf specifies a config file for each node, and
--cluster-slave --cluster-master-id <ID_OF_XXXX_NODE> sets the node as a slave of a specified master node.