how to delete nodes from redis cluster?
Asked Answered
H

4

7

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?

Heterotypic answered 8/4, 2016 at 4:55 Comment(0)
L
6

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.

Landlord answered 8/4, 2016 at 16:37 Comment(0)
T
3

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>
Thao answered 26/5, 2021 at 12:23 Comment(0)
A
2
src/redis-trib.rb del-node 192.168.0.211:6379 650e3746968e6b7c7e357f06adbde5b3b92fcceb

Note:

  • 192.168.0.211:6379 This is any node in the cluster
  • 650e3746968e6b7c7e357f06adbde5b3b92fcceb this is the cluster ID of the node you want to remove. You can get the value of this ID from “cluster nodes” command.
Arabella answered 21/6, 2016 at 12:21 Comment(0)
C
0

Per redis article you should use:

redis-cli --cluster del-node 127.0.0.1:7000

where the the first argument is one of your cluster nodes.

Check 'removing a node' in he following article:

https://redis.io/docs/manual/scaling/

Cryohydrate answered 7/9, 2022 at 14:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.