+ 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
+ end
+
+ def alloc_slots
+ slots_per_node = ClusterHashSlots/@nodes.length
+ i = 0
+ @nodes.each{|n|
+ first = i*slots_per_node
+ last = first+slots_per_node-1
+ last = ClusterHashSlots-1 if i == @nodes.length-1
+ n.add_slots first..last
+ i += 1
+ }
+ end
+
+ def flush_nodes_config
+ @nodes.each{|n|
+ n.flush_node_config
+ }
+ end
+
+ def show_nodes
+ @nodes.each{|n|
+ puts n.info
+ }
+ end
+
+ def join_cluster
+ end
+
+ def yes_or_die(msg)
+ print "#{msg} (type 'yes' to accept): "
+ STDOUT.flush
+ if !(STDIN.gets.chomp.downcase == "yes")
+ puts "Aborting..."
+ exit 1
+ end