diff options
author | Salvatore Sanfilippo <antirez@gmail.com> | 2015-10-15 13:02:35 +0200 |
---|---|---|
committer | Salvatore Sanfilippo <antirez@gmail.com> | 2015-10-15 13:02:35 +0200 |
commit | bdcb14556644ff501acb061b0a6bdfc24d6b5b81 (patch) | |
tree | 96f0b364ca91e11993df59f592a7467d975a31fc /src | |
parent | 6ed12bd430c14198e858916e3ebe4103fe2497ed (diff) | |
parent | 8a85ad2d1cc93dab909fbdff82ff54fa063759bf (diff) | |
download | redis-bdcb14556644ff501acb061b0a6bdfc24d6b5b81.tar.gz |
Merge pull request #2810 from dwlt/add-copy-replace-parameters-to-redis-trib-import
Add copy & replace parameters to redis-trib import
Diffstat (limited to 'src')
-rwxr-xr-x | src/redis-trib.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/redis-trib.rb b/src/redis-trib.rb index 8e07aa22a..068e60d4e 100755 --- a/src/redis-trib.rb +++ b/src/redis-trib.rb @@ -1149,7 +1149,9 @@ 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 +1186,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 +1349,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} } |