summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thomson <david@ludometrics.com>2015-10-14 06:56:14 +0100
committerantirez <antirez@gmail.com>2015-10-15 13:06:31 +0200
commit1fa63a78bc175d5adfdad23470fa3a24343f80f3 (patch)
tree80959dddab58d7a1f3e986785a2cb7dbf77444f9
parent568c83dda75e6111b211eedeecee0e24043866d0 (diff)
downloadredis-1fa63a78bc175d5adfdad23470fa3a24343f80f3.tar.gz
Update import command to optionally use copy and replace parameters
-rwxr-xr-xsrc/redis-trib.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/redis-trib.rb b/src/redis-trib.rb
index 8e07aa22a..577cf150d 100755
--- a/src/redis-trib.rb
+++ b/src/redis-trib.rb
@@ -1149,7 +1149,8 @@ class RedisTrib
def import_cluster_cmd(argv,opt)
source_addr = opt['from']
xputs ">>> Importing data from #{source_addr} to cluster #{argv[1]}"
-
+ use_copy = opt['copy']
+ use_replace = opt['replace']
# Check the existing cluster.
load_cluster_info_from_node(argv[0])
check_cluster
@@ -1184,7 +1185,10 @@ class RedisTrib
print "Migrating #{k} to #{target}: "
STDOUT.flush
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
puts e
else
@@ -1344,7 +1348,7 @@ COMMANDS={
ALLOWED_OPTIONS={
"create" => {"replicas" => 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}
}