Commit Graph

135 Commits

Author SHA1 Message Date
artix d222eda9f0 Redis-trib deprecated: it no longer works and it
outputs a warning to the user.
2018-07-13 10:51:58 +02:00
Jack Drogon 93238575f7 Fix typo 2018-07-03 18:19:46 +02:00
antirez 1673a3f32c Cluster: improve anti-affinity algo in redis-trib.rb.
See #3462 and related PRs.

We use a simple algorithm to calculate the level of affinity violation,
and then an optimizer that performs random swaps until things improve.
2018-01-18 11:44:19 +01:00
yyoshiki41 16f65068b0 Refactor redis-trib.rb 2016-10-10 01:13:20 +09:00
rojingeorge 4242fdf45c Display the nodes summary once the cluster is established using redis-trib.rb
Display the nodes summary once the cluster is established using
redis-trib.rb
After the cluster meet and join was done, when the summary was shown, it
was giving info regarding the nodes. This fix ensures that confusion
where the slaves were shown as masters.
Fix would be to reset the nodes and reload the cluster information
before checking the cluster status after creating it.
2016-06-23 21:58:03 +05:30
Salvatore Sanfilippo 09153b9127 Merge pull request #3152 from be-hase/fix/check_open_slots
Fix redis-trib.rb
2016-05-05 08:56:28 +02:00
antirez 67b70a1813 Fix ae.c to avoid timers infinite loop.
This fix was suggested by Anthony LaTorre, that provided also a good
test case that was used to verify the fix.

The problem with the old implementation is that, the time returned by
a timer event (that is the time after it want to run again) is added
to the event *start time*. So if the event takes, in order to run, more
than the time it says it want to be scheduled again for running, an
infinite loop is triggered.
2016-04-04 08:50:58 +02:00
Ryosuke Hasebe cad9ea5c68 fix variable 2016-03-30 23:09:36 +09:00
Ryosuke Hasebe d5aa7e2abe fix check_open_slots 2016-03-30 21:56:22 +09:00
antirez cbcffed907 Cluster: redis-trib: support @busport format in ClusterNode. 2016-02-02 08:27:36 +01:00
antirez f984cef217 Cluster: fix rebalancing to always empty nodes.
Because of rounding error even with weight=0 sometimes a node was left
with an assigned slot.

Close #3001.
2016-01-13 17:30:53 +01:00
antirez 152e9f67f8 Cluster: redis-trib move_to_slot: don't send SETSLOT to slaves. 2016-01-12 12:16:00 +01:00
antirez c6e508856a Cluster: fix redis-trib reference of variable in warning. 2016-01-11 16:37:51 +01:00
antirez 02c40c9dc2 CLUSTER BUMPEPOCH initial implementation fixed. 2016-01-11 15:39:11 +01:00
antirez e4eb6c7a5d Cluster: implement redis-trib fix when slot is open without owners.
Still work to do.
2016-01-11 15:05:19 +01:00
antirez 04ae459bc2 Cluster: implement redis-trib fix for uncovered slots. 2016-01-11 15:04:35 +01:00
antirez 190babe2df redis-trib: Remove duplicated key in hash initialization. 2016-01-02 13:13:32 +01:00
antirez 80b70371e8 Cluster: rebalance now supports --threshold option. 2015-12-18 15:51:39 +01:00
antirez 628af70214 Cluster: redis-trib reshard / rebalance --pipeline support. 2015-12-18 12:27:14 +01:00
antirez 8f8c3992ac Cluster: allows abbreviated node IDs with rebalance --weight option. 2015-12-15 16:08:00 +01:00
antirez 9df1ae8808 Cluster: rebalancing option --simulate, and a fix. 2015-12-15 15:48:49 +01:00
antirez cba1c29580 Cluster: redis-trib rebalance initial implementation. 2015-12-15 12:54:40 +01:00
antirez 3782902bec Initial implementation of redis-trib info subcommand. 2015-12-14 18:14:52 +01:00
antirez f0b168e894 Cluster: redis-trib: use variadic MIGRATE.
We use the new variadic/pipelined MIGRATE for faster migration.
Testing is not easy because to see the time it takes for a slot to be
migrated requires a very large data set, but even with all the overhead
of migrating multiple slots and to setup them properly, what used to
take 4 seconds (1 million keys, 200 slots migrated) is now 1.6 which is
a good improvement. However the improvement can be a lot larger if:

1. We use large datasets where a single slot has many keys.
2. By moving more than 10 keys per iteration, making this configurable,
   which is planned.

Close #2710
Close #2711
2015-12-11 18:12:56 +01:00
antirez e7945cf839 Cluster: redis-trib migrate default timeout set to 60 sec. 2015-12-11 11:00:27 +01:00
daniele 3d254e05f4 redis-trib.rb: --timeout XXXXX option added to fix and reshard commands. Defaults to 15000 milliseconds 2015-12-11 10:59:08 +01:00
David Thomson 8a85ad2d1c Add back blank line 2015-10-14 06:58:36 +01:00
David Thomson 03d0de7cdf Update import command to optionally use copy and replace parameters 2015-10-14 06:56:14 +01:00
antirez c372a59520 Cluster: redis-trib fix, coverage for migrating=1 case.
Kinda related to #2770.
2015-10-09 16:15:58 +02:00
Matt Stancliff bf58f8b513 Remove end of line whitespace from redis-trib 2015-01-08 13:31:03 -05:00
Matt Stancliff 1c477f62bc Fix redis-trib cluster create
Under certain conditions the node list wasn't being fully populated
and 'create' would fail trying to call methods on nil objects.
2015-01-08 13:28:35 -05:00
Matt Stancliff b55f742e46 Improve redis-trib replica assignment
This tiny bit of code has gone through so many revisions.  Hopefully
it's more correct now.

Fixes #2204
2014-12-19 21:56:14 -05:00
Salvatore Sanfilippo dea938440c Merge pull request #2107 from mattsta/fix-trib-import
Fix redis-trib import SCAN call
2014-12-11 15:05:38 +01:00
Matt Stancliff 14f2582da2 Fix redis-trib import SCAN call 2014-10-29 15:08:51 -04:00
Matt Stancliff bbf1af2da3 Fix redis-trib.rb IP:Port disassembly for IPv6
IP format is now any of:
  - 127.0.0.1:6379
  - ::1:6379
2014-10-29 15:08:35 -04:00
antirez de10b8d9cc redis-trib should not abort easily on connection issues. 2014-09-26 16:57:42 +02:00
antirez 15336ffe86 Cluster: fix redis-trib --from all. 2014-07-21 15:30:25 +02:00
antirez 73a809b159 redis-trib: allow to reshard in non-interactive way.
The introduction of --from --to --slots --yes options allow to reshard
from cli in an automated way from scripts. The code is ugly and needs
refactoring as soon as we get it in RC / stable release.
2014-07-18 17:43:49 +02:00
antirez 762b1ae2be Fix an error in redis-trib where we always talk with same node.
While iterating the list of nodes we want to set the slot as stable in
the current node, not always in the first node of the list.
2014-05-21 18:17:02 +02:00
antirez c68c78719f redis-trib fix improved: move keys from N nodes to owner. 2014-05-21 16:40:46 +02:00
antirez 56161ca0a4 redis-trib fix: use MIGRATE REPLACE when fixing slots.
This fixes issue #1765.
2014-05-21 12:15:06 +02:00
antirez 658ad301cc redis-trib create: use CONFIG SET-CONFIG-EPOCH before joining the cluster.
This way there is no need for the conflict resolution algo to be used in
order to start with a cluster where each node has a different
configEpoch.
2014-05-12 11:06:37 +02:00
antirez 715a6d3a78 redis-trib import: trap MIGRATE errors. 2014-05-12 10:36:33 +02:00
antirez 939c586ef7 redis-trib.rb: MIGRATE hardcoded timeout set to 15 sec.
Will be configurable / adaptive at some point but let's start with a
saner value compared to 1 sec which is not a good idea for big data
structures stored into a single key.
2014-05-12 10:22:24 +02:00
antirez 2a48bd4a37 Cluster: initial ability to import data from standalone instance. 2014-05-10 17:59:31 +02:00
antirez 74435aba47 redis-trib: allow support for mandatory options. 2014-05-09 16:11:11 +02:00
antirez 0064b1a583 Cluster: redis-trib cluster allocation more even across nodes.
redis-trib used to allocate slots not considering fractions of nodes
when computing the slots_per_node amount. So the fractional part was
carried over till the end of the allocation, where the last node
received a few more slots than any other (or a lot more if the cluster
was composed of many nodes).

The computation was changed to allocate slots more evenly when they are
not exactly divisible for the number of masters we have.
2014-03-25 17:44:39 +01:00
Salvatore Sanfilippo 8e6625e6ae Merge pull request #1629 from mattsta/fix-trib-master-assignment
Cluster: Restore proper trib master iteration
2014-03-24 18:31:55 +01:00
Matt Stancliff e942f3ce0f Cluster: Restore proper trib master iteration
This got removed in 2e5c394 during a new feature addition.

The prior commit had "break if masters.length == masters_count"
but we are guaranteed to aready have that condition met since
otherwise we would haven't gotten this far.

Without this break statement, it's possible some masters may
be forgotten and have zero replicas while other masters have
more than their requested number of replicas.

Thanks to carlos for pointing out this regression at:
https://groups.google.com/forum/#!topic/redis-db/_WVVqDw5B7c
2014-03-24 10:17:44 -04:00
Matt Stancliff df4bdbf688 Cluster: Fix trib create when masters==replicas
This bug was introduced in 2e5c394f during a refactor.

It took me a while to understand what was going on with
the code, so I've refactored it further by:
  - Replacing boolean values with meaningful symbols
  - Replacing 'i' with a meaningful variable name
  - Adding the proper abort check
  - Factoring out now duplicated conditionals
  - Adding optional verbose logging (we're inside *four*
    different looping constructs, so it takes a while to
    figure out where all the moving parts are)
  - Updating comment for the section

This fixes a problem when the number of master instances
equaled the number of replica instances.  Before, when
there were equal numbers of both, nodes_count would go to
zero, but the while loop would spin in i < @replicas because
i would never be updated (because the nodes_list of each ip
was length == 0, which triggered an endless loop of
next -> i = 0 -> 0 < 1? -> true -> next -> i = 0 ...)

Thanks to carlo who found this problem at:
https://groups.google.com/forum/#!topic/redis-db/_WVVqDw5B7c
2014-03-24 10:17:38 -04:00