+
+ # redis-trib subcommands implementations
+
+ def check_cluster_cmd
+ node = ClusterNode.new(ARGV[1])
+ node.connect(:abort => true)
+ node.assert_cluster
+ add_node(node)
+ check_cluster
+ end
+
+ def create_cluster_cmd
+ puts "Creating cluster"
+ ARGV[1..-1].each{|n|
+ node = ClusterNode.new(n)
+ node.connect(:abort => true)
+ node.assert_cluster
+ node.assert_empty
+ add_node(node)
+ }
+ puts "Performing hash slots allocation on #{@nodes.length} nodes..."
+ alloc_slots
+ show_nodes
+ yes_or_die "Can I set the above configuration?"
+ flush_nodes_config
+ puts "** Nodes configuration updated"
+ puts "** Sending CLUSTER MEET messages to join the cluster"
+ join_cluster
+ check_cluster
+ end