mirror of
https://github.com/fluencelabs/redis
synced 2025-04-01 23:31:03 +00:00
redis-trib: new subcommand 'call'. Exec command in all nodes.
Example: ./redis-trib.rb call 192.168.1.11:7000 config get cluster-node-timeout
This commit is contained in:
parent
2e5c394fa8
commit
df32eb6827
@ -952,6 +952,23 @@ class RedisTrib
|
|||||||
xputs ">>> New node timeout set. #{ok_count} OK, #{err_count} ERR."
|
xputs ">>> New node timeout set. #{ok_count} OK, #{err_count} ERR."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def call_cluster_cmd(argv,opt)
|
||||||
|
cmd = argv[1..-1]
|
||||||
|
cmd[0] = cmd[0].upcase
|
||||||
|
|
||||||
|
# Load cluster information
|
||||||
|
load_cluster_info_from_node(argv[0])
|
||||||
|
xputs ">>> Calling #{cmd.join(" ")}"
|
||||||
|
@nodes.each{|n|
|
||||||
|
begin
|
||||||
|
res = n.r.send(*cmd)
|
||||||
|
puts "#{n}: #{res}"
|
||||||
|
rescue => e
|
||||||
|
puts "#{n}: #{e}"
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def help_cluster_cmd(argv,opt)
|
def help_cluster_cmd(argv,opt)
|
||||||
show_help
|
show_help
|
||||||
exit 0
|
exit 0
|
||||||
@ -995,6 +1012,7 @@ COMMANDS={
|
|||||||
"add-node" => ["addnode_cluster_cmd", 3, "new_host:new_port existing_host:existing_port"],
|
"add-node" => ["addnode_cluster_cmd", 3, "new_host:new_port existing_host:existing_port"],
|
||||||
"del-node" => ["delnode_cluster_cmd", 3, "host:port node_id"],
|
"del-node" => ["delnode_cluster_cmd", 3, "host:port node_id"],
|
||||||
"set-timeout" => ["set_timeout_cluster_cmd", 3, "host:port milliseconds"],
|
"set-timeout" => ["set_timeout_cluster_cmd", 3, "host:port milliseconds"],
|
||||||
|
"call" => ["call_cluster_cmd", -3, "host:port command arg arg .. arg"],
|
||||||
"help" => ["help_cluster_cmd", 1, "(show this help)"]
|
"help" => ["help_cluster_cmd", 1, "(show this help)"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user