Redis Cluster Tutorial-6
Redis Cluster Tutorial-6
follow by humans.
Starting the application produces the following output:
ruby ./example.rb
You only need to specify a single node, redis-cli will find the other nodes automatically.
Currently redis-cli is only able to reshard with the administrator support, you can't just
say move 5% of slots from this node to the other one (but this is pretty trivial to
implement). So it starts with questions. The first is how much a big resharding do you
want to do:
We can try to reshard 1000 hash slots, that should already contain a non trivial amount
of keys if the example is still running without the sleep call.
Then redis-cli needs to know what is the target of the resharding, that is, the node that
will receive the hash slots. I'll use the first master node, that is, 127.0.0.1:7000, but I
need to specify the Node ID of the instance. This was already printed in a list by redis-
cli, but I can always find the ID of a node with the following command if I need:
97a3a64667477371c4479320d683e4c8db5858b1 :0 myself,master - 0 0 0
connected 0-5460
All the slots will be covered as usual, but this time the master at 127.0.0.1:7000 will
have more hash slots, something around 6461.
This allows to build some automatism if you are likely to reshard often, however
currently there is no way for redis-cli to automatically rebalance the cluster checking the
distribution of keys across the cluster nodes and intelligently moving slots as needed.
This feature will be added in the future.