summaryrefslogtreecommitdiff
path: root/src/redis-trib.rb
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-12-15 15:48:49 +0100
committerantirez <antirez@gmail.com>2015-12-15 15:48:49 +0100
commit9df1ae8808ae52506e348065c241c5367fd88c07 (patch)
tree86a02e4ff08baa6775b0538c7db23b628f6b7a05 /src/redis-trib.rb
parentcba1c29580e6ffa12fdb19b83007050264b4bf87 (diff)
downloadredis-9df1ae8808ae52506e348065c241c5367fd88c07.tar.gz
Cluster: rebalancing option --simulate, and a fix.
Diffstat (limited to 'src/redis-trib.rb')
-rwxr-xr-xsrc/redis-trib.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/redis-trib.rb b/src/redis-trib.rb
index b065365d9..4449973c6 100755
--- a/src/redis-trib.rb
+++ b/src/redis-trib.rb
@@ -943,7 +943,7 @@ class RedisTrib
# Sort nodes by their slots balance.
sn = @nodes.select{|n|
- n.has_flag?("master")
+ n.has_flag?("master") && n.info[:w]
}.sort{|a,b|
a.info[:balance] <=> b.info[:balance]
}
@@ -974,12 +974,16 @@ class RedisTrib
xputs "*** Assertio failed: Reshard table != number of slots"
exit 1
end
- reshard_table.each{|e|
- move_slot(e[:source],dst,e[:slot],
- :quiet=>true,:dots=>false,:update=>true)
- print "#"
- STDOUT.flush
- }
+ if opt['simulate']
+ print "#"*reshard_table.length
+ else
+ reshard_table.each{|e|
+ move_slot(e[:source],dst,e[:slot],
+ :quiet=>true,:dots=>false,:update=>true)
+ print "#"
+ STDOUT.flush
+ }
+ end
puts
end
@@ -1512,7 +1516,7 @@ ALLOWED_OPTIONS={
"add-node" => {"slave" => false, "master-id" => true},
"import" => {"from" => :required, "copy" => false, "replace" => false},
"reshard" => {"from" => true, "to" => true, "slots" => true, "yes" => false, "timeout" => MigrateDefaultTimeout},
- "rebalance" => {"weight" => [], "auto-weights" => false, "threshold" => RebalanceDefaultThreshold, "use-empty-masters" => false, "timeout" => MigrateDefaultTimeout},
+ "rebalance" => {"weight" => [], "auto-weights" => false, "threshold" => RebalanceDefaultThreshold, "use-empty-masters" => false, "timeout" => MigrateDefaultTimeout, "simulate" => false},
"fix" => {"timeout" => MigrateDefaultTimeout},
}