how to delete nodes from redis cluster?

bylijinnan picture bylijinnan · Apr 8, 2016 · Viewed 8.1k times · Source

I google it and found two solution:

  1. CLUSTER FORGET (http://redis.io/commands/cluster-forget)

  2. redis-trib.rb del-node

I think CLUSTER FORGET" is the right way to do.

But I really want to know the details about redis-trib.rb del-node.

Can someone explain the difference between them?

Answer

AlexB picture AlexB · Apr 8, 2016

redis-trib.rb is a ruby utility script that antirez (lead redis developer) built as a reference implementation of building administrative tools on top of the basic redis cluster commands.

Under the hood redis-trib uses CLUSTER FORGET to implement it's own administrative del-node command. https://github.com/antirez/redis/blob/unstable/src/redis-trib.rb#L1374

Redis-trib is a lot friendlier to work with. If you're doing CLUSTER FORGET you'd need to loop over and send that command to every other node in the system, while del-node will automate that process for you.