mirror of
https://github.com/fluencelabs/redis
synced 2025-04-26 11:02:13 +00:00
redis-trib: actual slot migration work in progress, more work needed.
This commit is contained in:
parent
c5954c1966
commit
9a38df8799
@ -318,6 +318,16 @@ class RedisTrib
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def move_slot(source,target,slot)
|
||||||
|
# We start marking the slot as importing in the destination node,
|
||||||
|
# and the slot as migrating in the target host. Note that the order of
|
||||||
|
# the operations is important, as otherwise a client may be redirected to
|
||||||
|
# the target node that does not yet know it is importing this slot.
|
||||||
|
target.r("cluster","setslot",slot,"importing",source.info[:name])
|
||||||
|
source.r("cluster","setslot",slot,"migrating",source.info[:name])
|
||||||
|
# Migrate all the keys from source to target using the MIGRATE command
|
||||||
|
end
|
||||||
|
|
||||||
# redis-trib subcommands implementations
|
# redis-trib subcommands implementations
|
||||||
|
|
||||||
def check_cluster_cmd
|
def check_cluster_cmd
|
||||||
@ -380,7 +390,14 @@ class RedisTrib
|
|||||||
puts " Destination node:"
|
puts " Destination node:"
|
||||||
puts " #{target.info_string}"
|
puts " #{target.info_string}"
|
||||||
reshard_table = compute_reshard_table(sources,numslots)
|
reshard_table = compute_reshard_table(sources,numslots)
|
||||||
|
puts " Resharding plan:"
|
||||||
show_reshard_table(reshard_table)
|
show_reshard_table(reshard_table)
|
||||||
|
print "Do you want to proceed with the proposed reshard plan (yes/no)? "
|
||||||
|
yesno = STDIN.gets.chop
|
||||||
|
exit(1) if (yesno != "yes")
|
||||||
|
reshard_table.each{|e|
|
||||||
|
move_slot(e[:source],target,e[:slot])
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_cluster_cmd
|
def create_cluster_cmd
|
||||||
|
Loading…
x
Reference in New Issue
Block a user