Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
025628bd
Commit
025628bd
authored
Dec 15, 2015
by
antirez
Browse files
Cluster: rebalancing option --simulate, and a fix.
parent
f501f5f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-trib.rb
View file @
025628bd
...
@@ -943,7 +943,7 @@ class RedisTrib
...
@@ -943,7 +943,7 @@ class RedisTrib
# Sort nodes by their slots balance.
# Sort nodes by their slots balance.
sn = @nodes.select{|n|
sn = @nodes.select{|n|
n
.
has_flag?
(
"master"
)
n.has_flag?("master")
&& n.info[:w]
}.sort{|a,b|
}.sort{|a,b|
a.info[:balance] <=> b.info[:balance]
a.info[:balance] <=> b.info[:balance]
}
}
...
@@ -974,12 +974,16 @@ class RedisTrib
...
@@ -974,12 +974,16 @@ class RedisTrib
xputs "*** Assertio failed: Reshard table != number of slots"
xputs "*** Assertio failed: Reshard table != number of slots"
exit 1
exit 1
end
end
reshard_table
.
each
{
|
e
|
if opt['simulate']
move_slot
(
e
[
:source
],
dst
,
e
[
:slot
],
print "#"*reshard_table.length
:quiet
=>
true
,
:dots
=>
false
,
:update
=>
true
)
else
print
"#"
reshard_table.each{|e|
STDOUT
.
flush
move_slot(e[:source],dst,e[:slot],
}
:quiet=>true,:dots=>false,:update=>true)
print "#"
STDOUT.flush
}
end
puts
puts
end
end
...
@@ -1512,7 +1516,7 @@ ALLOWED_OPTIONS={
...
@@ -1512,7 +1516,7 @@ ALLOWED_OPTIONS={
"add-node" => {"slave" => false, "master-id" => true},
"add-node" => {"slave" => false, "master-id" => true},
"import" => {"from" => :required, "copy" => false, "replace" => false},
"import" => {"from" => :required, "copy" => false, "replace" => false},
"reshard" => {"from" => true, "to" => true, "slots" => true, "yes" => false, "timeout" => MigrateDefaultTimeout},
"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},
"fix" => {"timeout" => MigrateDefaultTimeout},
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment