ruster - a simple Redis Cluster Administration tool

Control your Redis Cluster from the command line.

Usage

ruster relies on redic, the lightweight Redis client. It currently allows to create a cluster, add and remove nodes, and execute a command in all nodes in a cluster.

Create a cluster

$ ruster create ip:port [ip:port...]

Creates a cluster with all the indicated nodes, and automatically shards Redis Cluster 16,384 slots evenly among all of them.

Add a node

$ ruster add cluster_ip:port ip:port

Adds ip:port to the cluster. cluster_ip:port must be one of the nodes that are already part of the cluster.

Remove a node

$ ruster remove cluster_ip:port ip:port

Removes ip:port from the cluster. cluster_ip:port must be one of the nodes that are already part of the cluster. The only requirement is that ip:port isn't the same as cluster_ip:port.

NOTE: removing a node that has slots assigned leaves the cluster in a broken state. These slots should be resharded before removing the node.

Execute a command in all nodes

$ ruster each ip:port [CMD ...]

Executes the Redis command in all nodes, displaying it's result in STDOUT.

Reshard

$ ruster reshard cluster_ip:port slots target_ip:port source_ip:port [...]

Reshards the cluster at cluster_ip:port, by moving slots slots from several source_ip:port to target_ip:port.

It accepts the following parameters:

  • -n indicate destination DB (currently only 0 seem to be working)
  • -t indicate timeout for MIGRATE keys

Global parameters

ruster accepts the following global parameters:

  • -v verbose output. It could be used multiple times, to indicate the level of verbosity.
  1. display log messages
  2. display Redis commands sent to the cluster

TODO

  • documentation
  • resharding
  • add interactive interface
  • add REPL?
  • fix cluster
  • check cluster state
  • cluster information
  • ASSERTIONS

Installation

$ gem install ruster

Thanks

This work wouldn't have been possible without @antirez awesome work on Redis, and @soveran and @cyx for their super lightweight Redis client.

Thank you to my dear friends @lucasefe, @pote and @elcuervo, who joined the conversation on Twitter while I was looking for a name.

Also, I'd like to thank to Eruca Sativa and Cirse for the music that's currently blasting my speakers while I write this.

Who said programming shouldn't be fun? Discuss on Hacker News.