Commit 4dded0c1 authored by antirez's avatar antirez
Browse files

redis-trib: ignore slaves when resharding.

parent 47da7657
...@@ -576,8 +576,9 @@ class RedisTrib ...@@ -576,8 +576,9 @@ class RedisTrib
while not target while not target
print "What is the receiving node ID? " print "What is the receiving node ID? "
target = get_node_by_name(STDIN.gets.chop) target = get_node_by_name(STDIN.gets.chop)
if not target if !target || target.has_flag?("slave")
puts "The specified node is not known, please retry." puts "The specified node is not known or not a master, please retry."
target = nil
end end
end end
sources = [] sources = []
...@@ -598,11 +599,12 @@ class RedisTrib ...@@ -598,11 +599,12 @@ class RedisTrib
elsif line == "all" elsif line == "all"
@nodes.each{|n| @nodes.each{|n|
next if n.info[:name] == target.info[:name] next if n.info[:name] == target.info[:name]
next if n.has_flag?("slave")
sources << n sources << n
} }
break break
elsif not src elsif !src || src.has_flags?("slave")
puts "The specified node is not known, please retry." puts "The specified node is not known or is not a master, please retry."
elsif src.info[:name] == target.info[:name] elsif src.info[:name] == target.info[:name]
puts "It is not possible to use the target node as source node." puts "It is not possible to use the target node as source node."
else else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment