Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
bdcb1455
Commit
bdcb1455
authored
Oct 15, 2015
by
Salvatore Sanfilippo
Browse files
Merge pull request #2810 from dwlt/add-copy-replace-parameters-to-redis-trib-import
Add copy & replace parameters to redis-trib import
parents
6ed12bd4
8a85ad2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-trib.rb
View file @
bdcb1455
...
...
@@ -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
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment