Permalink
Browse files

use private ip lengths to determine num of nodes

  • Loading branch information...
ronniedada committed Aug 28, 2013
1 parent 3c0a974 commit dd28159975678216f868abbbbefb108ab348efcb
Showing with 2 additions and 7 deletions.
  1. +2 −7 cookbooks/couchbase/recipes/setup-2.1.1.rb
@@ -85,6 +85,7 @@
known_hosts = ""
username = node[:db_couchbase][:cluster][:username]
password = node[:db_couchbase][:cluster][:password]
private_ips = ""
if cluster_tag and !cluster_tag.empty?
now = DateTime.now.strftime("%Y%m%d-%H%M%S.%L")
log("clustering - now is #{now}")
@@ -167,13 +168,7 @@
# rebalance if certain conditions been met
rebalance_count = node[:db_couchbase][:cluster][:rebalance_count]
cmd = "wget --user=#{username} --password=#{password}" +
" http://localhost:8091/pools/default/ -O data.json"
`#{cmd}`
file = open("data.json")
json = file.read
parsed = JSON.parse(json)
num_nodes = parsed["nodes"].length
num_nodes = private_ips.length + 1
if num_nodes >= rebalance_count.to_i
log("rebalancing: (num_nodes = #{num_nodes}) >= (rebalance_count = #{rebalance_count})")
log("/opt/couchbase/bin/couchbase-cli rebalance" +

0 comments on commit dd28159

Please sign in to comment.