90 Commits

Author SHA1 Message Date
antirez
630a447449 redis-trib: allow support for mandatory options. 2014-05-09 16:11:11 +02:00
antirez
41fb27d1d1 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
b8fed78aa5 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
794d3401e9 Cluster: Restore proper trib master iteration
This got removed in 15ef91e 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
173f9ae558 Cluster: Fix trib create when masters==replicas
This bug was introduced in 15ef91eb 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
antirez
18dafd646a redis-trib: call MIGRATE via r.client.call as fix for redis-rb API changes.
See issue #1593.

Thanks to @badboy for suggesting the direct client.call fix.
2014-03-11 16:10:13 +01:00
antirez
5604970426 redis-trib: new subcommand 'call'. Exec command in all nodes.
Example:

./redis-trib.rb call 192.168.1.11:7000 config get cluster-node-timeout
2014-03-11 14:58:55 +01:00
antirez
15ef91eb7b redis-trib: create subcommand is now able to assign spare slaves.
Example: if the user will try to configure a cluster with 9 nodes,
asking for 1 slave for master, redis-trib will configure a 4 masters
cluster with 1 slave each as usually, but this time will assign the
spare node as a slave of one of the masters.
2014-03-11 14:17:28 +01:00
antirez
234fafca84 Cluster: redis-trib fix: handling of another trivial case. 2014-02-11 10:13:18 +01:00
antirez
5a79453abf Cluster: remove debugging xputs from redis-trib. 2014-02-10 19:14:05 +01:00
antirez
e4732138b0 Cluster: redis-trib fix: cover new case of open slot.
The case is the trivial one a single node claiming the slot as
migrating, without nodes claiming it as importing.
2014-02-10 19:10:23 +01:00
antirez
2411d8fd94 redis-trib: log event after we have reference to 'master'. 2014-02-10 18:48:40 +01:00
antirez
a136867cc4 Cluster: redis-trib, more info about open slots error. 2014-02-10 17:44:16 +01:00
antirez
aa408d80eb Cluster: redis-trib del-node variable typo fixed. 2014-02-10 16:59:09 +01:00
antirez
6b4ab670b5 Cluster: redis-trib: options table entry for add-node fixed. 2014-02-10 12:34:21 +01:00
antirez
505e3836a7 Cluster: redis-trib set-timeout implemented. 2014-01-24 15:06:01 +01:00
antirez
c40ca44941 Cluster: redis-trib shows number of replicas of masters. 2014-01-17 17:56:45 +01:00
antirez
383b2d63ea Cluster: redis-trib help output format modified. 2014-01-17 12:32:49 +01:00
antirez
9fe6577942 Cluster: redis-trib shows what a slave replicates + fixes.
Also the :replicates info field in the node object is now correctly
populated. This also fixes the :replicas field computation.
2014-01-17 12:06:18 +01:00
antirez
82859e547d Cluster: redis-trib addnode is now able to add replicas. 2014-01-17 11:48:42 +01:00
antirez
a422dceef7 Cluster: fix redis-trib help subcommand. 2014-01-17 10:29:40 +01:00
antirez
ef73ddbca9 Cluster: redis-trib delnode implementation. 2014-01-16 18:22:03 +01:00
antirez
2c9f8fc22b Cluster: redis-trib help output improved.
Show options if any. Clarify that for some command any node address is
ok.
2014-01-16 16:23:33 +01:00
antirez
b1d3dd657d Cluster: use an hardcoded 60 sec timeout in redis-trib connections.
Later this should be configurable from the command line but at least now
we use something more appropriate for our use case compared to the
redis-rb default timeout.
2013-12-17 10:00:33 +01:00
antirez
605ba6ad38 redis-trib: fixed slot allocation when --replicas is used. 2013-11-07 16:12:06 +01:00
antirez
e1a469d3b0 Initial support for --replicas in redis-trib. 2013-11-05 11:24:24 +01:00
antirez
0dbe09bfec Cluster: rough support for sub-command options in redis-trib. 2013-10-11 17:33:19 +02:00
antirez
d392f33abb Cluster: fix redis-trib node config fingerprinting for new nodes format. 2013-09-25 12:58:06 +02:00
antirez
2cac667a8b Cluster: fix redis-trib for added configEpoch field in CLUSTER NODES. 2013-09-25 12:44:56 +02:00
antirez
1a83a42ead redis-trib: ClusterNode #info_string output modified.
The hope is that the new one is more readable.
2013-03-26 18:16:03 +01:00
antirez
825437016c redis-trib: wait cluster join after cluster creation. 2013-03-25 13:14:17 +01:00
antirez
fcb29e211e redis-trib: Don't use colorization if TERM != xterm. 2013-03-25 12:51:53 +01:00
antirez
a0786d3876 redis-trib: initial output colorization 2013-03-25 12:50:38 +01:00
antirez
e9384bb846 redis-trib: All output wrapped by a specific function.
This is needed in order to colorize it as next step.
We use conventions in output messages such as

>>> This is an action
*** This is a warning
[ERR] This is an error
[OK] That's fine

And so forth, so that a color will be associated checking the first
three chars.
2013-03-22 17:39:43 +01:00
antirez
4047f418f2 redis-trib: fix open slot correction.
Slot zero was hardcoded (!)
2013-03-22 13:03:33 +01:00
antirez
6690bb21e5 redis-trib: added cluster_error method to add errors. 2013-03-22 12:59:18 +01:00
antirez
6b7f840f6a redis-trib: fixed ClusterNode migrating/importing slots detection. 2013-03-22 12:54:04 +01:00
antirez
a919ff08a7 redis-trib: added some more output for check. 2013-03-22 12:47:49 +01:00
antirez
167e31d585 redis-trib: fixed type has_flags? -> has_flag. 2013-03-22 12:28:06 +01:00
antirez
fbc1d38061 redis-trib: ignore slaves when resharding. 2013-03-21 18:17:06 +01:00
antirez
3a6c3eaf51 redis-trib: fix conditional otherwise always true. 2013-03-21 17:22:14 +01:00
antirez
ffc76cd6e8 redis-trib: initial support to fix "open" slots.
Open slots are slots found in importing or migrating slot when a
cluster check is performed.
2013-03-21 17:11:54 +01:00
antirez
1bafc1dc40 redis-trib: load info about importing/migrating slots from node. 2013-03-21 16:31:53 +01:00
antirez
475f2db051 redis-trib: don't load cluster config from nodes in FAIL state. 2013-03-19 09:46:12 +01:00
antirez
5e5b822277 redis-trib: skip nodes without slots when creating the config signature. 2013-02-28 13:12:56 +01:00
antirez
f7e497ce38 redis-trib help. 2013-02-27 18:02:22 +01:00
antirez
8d4ae49ece redis-trib: skip noaddr and disconnected nodes while loading cluster info. 2013-02-27 17:23:11 +01:00
antirez
5b28421929 redis-trib: initial implementation of addnode command. 2013-02-27 15:58:41 +01:00
antirez
3a4bb6cee4 redis-trib: check that all the nodes agree about the slots configuration. 2013-02-22 12:25:16 +01:00
antirez
361e58008b redis-trib: skeleton of coverage fix for "keys in multiple nodes" case. 2013-02-22 11:33:10 +01:00