]>
git.saurik.com Git - redis.git/blob - src/redis-trib.rb
15 puts
"Invalid node name #{node}"
27 xputs
"Connecting to node #{self}: "
29 @r = Redis
.new(:host => @ost, :port => @port)
33 puts
"Sorry, can't connect to node #{self}"
40 if !info
["cluster_enabled"] || info
["cluster_enabled"].to_i
== 0
41 puts
"Error: Node #{self} is not configured as a cluster node."
47 if !
(@r.cluster("info").split("\r\n").index("cluster_known_nodes:1")) ||
49 puts
"Error: Node #{self} is not empty. Either the node already knows other nodes (check with nodes-info) or contains some key in database 0."
60 def check_arity(req_args
, num_args
)
61 if ((req_args
> 0 and num_args !
= req_args
) ||
62 (req_args
< 0 and num_args
< req_args
.abs
))
63 puts
"Wrong number of arguments for specified sub command"
69 puts
"Creating cluster"
71 node
= ClusterNode
.new(n
)
80 "create-cluster" => ["create_cluster", -2]
85 puts
"Usage: redis-trib <command> <arguments ...>"
90 cmd_spec
= COMMANDS
[ARGV[0].downcase
]
92 puts
"Unknown redis-trib subcommand '#{ARGV[0]}'"
95 rt
.check_arity(cmd_spec
[1],ARGV.length
)