0
0
Redisquery~30 mins

Adding and removing nodes in Redis - Mini Project: Build & Apply

Choose your learning style9 modes available
Adding and Removing Nodes in Redis Cluster
📖 Scenario: You are managing a Redis cluster for a growing online store. The cluster needs to be updated by adding a new node to handle more traffic and removing an old node that is no longer needed.
🎯 Goal: Learn how to add a new node to a Redis cluster and remove an existing node using Redis CLI commands.
📋 What You'll Learn
Create a Redis cluster with three nodes
Add a new node to the existing cluster
Remove an existing node from the cluster
Verify the cluster nodes after each operation
💡 Why This Matters
🌍 Real World
Managing Redis clusters is essential for scaling applications that require fast data access and high availability.
💼 Career
Database administrators and backend engineers often need to add or remove nodes in Redis clusters to maintain performance and reliability.
Progress0 / 4 steps
1
Create a Redis cluster with three nodes
Use the Redis CLI command redis-cli --cluster create with the exact node addresses 127.0.0.1:7000, 127.0.0.1:7001, and 127.0.0.1:7002 to create a cluster. Include the --cluster-replicas 0 option to create no replicas.
Redis
Need a hint?

Use redis-cli --cluster create followed by the three node addresses and --cluster-replicas 0.

2
Add a new node to the existing cluster
Use the Redis CLI command redis-cli --cluster add-node to add the new node 127.0.0.1:7003 to the cluster. Specify the existing cluster node 127.0.0.1:7000 as the target for the join.
Redis
Need a hint?

Use redis-cli --cluster add-node 127.0.0.1:7003 127.0.0.1:7000 to add the new node.

3
Remove an existing node from the cluster
Use the Redis CLI command redis-cli --cluster del-node to remove the node 127.0.0.1:7001 from the cluster. You need to specify the cluster node 127.0.0.1:7000 and the node ID of 127.0.0.1:7001. For this exercise, use the placeholder node ID node-id-7001 exactly as shown.
Redis
Need a hint?

Use redis-cli --cluster del-node 127.0.0.1:7000 node-id-7001 to remove the node.

4
Verify the cluster nodes after changes
Use the Redis CLI command redis-cli --cluster nodes with the cluster node 127.0.0.1:7000 to list all nodes currently in the cluster.
Redis
Need a hint?

Use redis-cli --cluster nodes 127.0.0.1:7000 to see the current cluster nodes.