Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to delete nodes from redis cluster?

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?

like image 834
bylijinnan Avatar asked Apr 08 '16 04:04

bylijinnan


2 Answers

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.

like image 177
AlexB Avatar answered Sep 22 '22 14:09

AlexB


As of Redis 6.2.3

WARNING: redis-trib.rb is not longer available! You should use redis-cli instead.

All commands and features belonging to redis-trib.rb have been moved to redis-cli. In order to use them you should call redis-cli with the --cluster option followed by the subcommand name, arguments and options.

Use the following syntax: redis-cli --cluster SUBCOMMAND [ARGUMENTS] [OPTIONS]

Example: redis-cli --cluster info 127.0.0.1:6382


~$ redis-cli
127.0.0.1:6379> CLUSTER HELP
127.0.0.1:6379> CLUSTER NODES
127.0.0.1:6379> CLUSTER FORGET <node-id>
like image 36
Amol M Kulkarni Avatar answered Sep 19 '22 14:09

Amol M Kulkarni