0
0
Redisquery~10 mins

Cluster creation in Redis - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Cluster creation
Start Redis nodes
Assign node IDs
Configure cluster slots
Connect nodes
Replicate nodes assigned
Cluster ready
The flow shows starting Redis nodes, assigning IDs, configuring slots, connecting nodes, assigning replicas, and completing cluster setup.
Execution Sample
Redis
redis-cli --cluster create \
  127.0.0.1:7000 127.0.0.1:7001 \
  127.0.0.1:7002 127.0.0.1:7003 \
  --cluster-replicas 1
This command creates a Redis cluster with 4 nodes and assigns 1 replica per master.
Execution Table
StepActionDetailsResult
1Start nodesNodes at ports 7000,7001,7002,7003 startedNodes running
2Assign node IDsEach node gets unique IDNode IDs assigned
3Configure slotsSlots 0-16383 divided among mastersSlots assigned to nodes
4Connect nodesNodes exchange info and connectCluster nodes linked
5Assign replicasEach master assigned 1 replicaReplication set
6Cluster readyCluster state is OKCluster operational
7ExitAll steps doneCluster creation complete
💡 All nodes configured and connected, cluster is operational
Variable Tracker
VariableStartAfter Step 2After Step 3After Step 5Final
nodesNot runningRunning with IDsSlots assignedReplicas assignedCluster operational
slotsNoneNoneDistributed among mastersDistributedDistributed
replicasNoneNoneNoneAssigned to mastersAssigned
Key Moments - 3 Insights
Why do we assign slots to nodes during cluster creation?
Slots determine which node holds which part of the data. See execution_table row 3 where slots are divided among masters.
What does '--cluster-replicas 1' mean in the command?
It means each master node will have one replica node for data redundancy, as shown in execution_table row 5.
Why must all nodes be running before creating the cluster?
Because the cluster command connects nodes and assigns roles; if nodes are not running, connection fails. See execution_table row 1.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at which step are slots assigned to nodes?
AStep 3
BStep 4
CStep 2
DStep 5
💡 Hint
Check the 'Configure slots' action in execution_table row 3
According to variable_tracker, what is the state of 'replicas' after Step 3?
ADistributed among masters
BAssigned to masters
CNone
DCluster operational
💡 Hint
Look at the 'replicas' row under 'After Step 3' column in variable_tracker
If a node is not running at Step 1, what will happen to cluster creation?
ACluster creation proceeds normally
BCluster creation fails due to connection issues
CNode IDs assigned anyway
DSlots assigned to offline nodes
💡 Hint
Refer to key_moments question about nodes running and execution_table row 1
Concept Snapshot
Redis Cluster Creation:
- Start multiple Redis nodes
- Assign unique node IDs
- Divide hash slots among master nodes
- Connect nodes to form cluster
- Assign replicas per master (--cluster-replicas)
- Cluster becomes operational after setup
Full Transcript
To create a Redis cluster, first start all Redis nodes on different ports. Each node receives a unique ID. Then, the cluster slots (0 to 16383) are divided among the master nodes to distribute data. Nodes connect to each other exchanging cluster info. Replicas are assigned to masters for redundancy based on the --cluster-replicas option. When all steps complete, the cluster is operational and ready to use.