How to Safely Delete Master and Slave Nodes in a Redis Cluster
This guide explains the two scenarios for removing nodes from a Redis cluster—deleting a master node by first migrating its slots and then removing it, and deleting a slave node directly—along with the exact redis-trib.rb commands and verification steps to ensure successful removal.
Delete Master Node
To delete a master node, first move its slots to other nodes, then perform the deletion.
Execute a reshard operation: redis-trib.rb reshard 127.0.0.1:7000 Enter the number of slots to move, the destination node ID, the source node ID (the node to be removed), and then type done. After the plan is displayed, confirm with yes to start the migration.
Verify that the master node now has zero slots: redis-trib.rb check 127.0.0.1:7000 Delete the master node:
redis-trib.rb del-node 127.0.0.1:7000 b0734e888058eab62527384e5d280ebbe57bf348(The command format is redis-trib.rb del-node host:port nodeID.)
Check the cluster status again to confirm successful removal: redis-trib.rb check 127.0.0.1:7000 If the removed master had a slave, the slave is automatically reassigned to another master.
Delete Slave Node
Removing a slave node is straightforward: run the delete command directly.
redis-trib.rb del-node 127.0.0.1:7000 <em>nodeID_to_remove</em>Finally, verify the cluster state:
redis-trib.rb check 127.0.0.1:7000Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java High-Performance Architecture
Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
