mirror of
https://github.com/fluencelabs/redis
synced 2025-04-01 15:21:03 +00:00
Update import command to optionally use copy and replace parameters
This commit is contained in:
parent
c372a59520
commit
03d0de7cdf
@ -1149,7 +1149,8 @@ class RedisTrib
|
|||||||
def import_cluster_cmd(argv,opt)
|
def import_cluster_cmd(argv,opt)
|
||||||
source_addr = opt['from']
|
source_addr = opt['from']
|
||||||
xputs ">>> Importing data from #{source_addr} to cluster #{argv[1]}"
|
xputs ">>> Importing data from #{source_addr} to cluster #{argv[1]}"
|
||||||
|
use_copy = opt['copy']
|
||||||
|
use_replace = opt['replace']
|
||||||
# Check the existing cluster.
|
# Check the existing cluster.
|
||||||
load_cluster_info_from_node(argv[0])
|
load_cluster_info_from_node(argv[0])
|
||||||
check_cluster
|
check_cluster
|
||||||
@ -1184,7 +1185,10 @@ class RedisTrib
|
|||||||
print "Migrating #{k} to #{target}: "
|
print "Migrating #{k} to #{target}: "
|
||||||
STDOUT.flush
|
STDOUT.flush
|
||||||
begin
|
begin
|
||||||
source.client.call(["migrate",target.info[:host],target.info[:port],k,0,15000])
|
cmd = ["migrate",target.info[:host],target.info[:port],k,0,15000]
|
||||||
|
cmd << :copy if use_copy
|
||||||
|
cmd << :replace if use_replace
|
||||||
|
source.client.call(cmd)
|
||||||
rescue => e
|
rescue => e
|
||||||
puts e
|
puts e
|
||||||
else
|
else
|
||||||
@ -1344,7 +1348,7 @@ COMMANDS={
|
|||||||
ALLOWED_OPTIONS={
|
ALLOWED_OPTIONS={
|
||||||
"create" => {"replicas" => true},
|
"create" => {"replicas" => true},
|
||||||
"add-node" => {"slave" => false, "master-id" => true},
|
"add-node" => {"slave" => false, "master-id" => true},
|
||||||
"import" => {"from" => :required},
|
"import" => {"from" => :required, "copy" => false, "replace" => false},
|
||||||
"reshard" => {"from" => true, "to" => true, "slots" => true, "yes" => false}
|
"reshard" => {"from" => true, "to" => true, "slots" => true, "yes" => false}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user