Skip to content

Commit

Permalink
the number of cpus is now configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
everpeace committed Mar 1, 2014
1 parent 98711b3 commit 8ee71da
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,14 @@ zk_n: 1 # hostname will be zk1, zk2, …
master_n: 2 # hostname will be master1,master2,…
slave_n : 2 # hostname will be slave1,slave2,…
# Memory setting(only for virtualbox)
# Memory and Cpus setting(only for virtualbox)
##########################################
zk_mem : 256
master_mem: 256
slave_mem : 256
zk_mem : 256
zk_cpus : 1
master_mem : 256
master_cpus: 1
slave_mem : 512
slave_cpus : 2
# private ip bases
# When ec2, this should be matched with
Expand Down
2 changes: 1 addition & 1 deletion multinodes/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Vagrant.configure("2") do |config|
override.vm.provision :hosts

vb.name = 'vagrant-mesos-' + ninfo[:hostname]
vb.customize ["modifyvm", :id, "--memory", ninfo[:mem] ]
vb.customize ["modifyvm", :id, "--memory", ninfo[:mem], "--cpus", ninfo[:cpus] ]

override.vm.provision :shell do |s|
s.path = "scripts/populate_sshkey.sh"
Expand Down
11 changes: 7 additions & 4 deletions multinodes/cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ zk_n: 1 # hostname will be zk1, zk2, …
master_n: 2 # hostname will be master1,master2,…
slave_n: 2 # hostname will be slave1,slave2,…

# Memory setting(only for virtualbox)
# Memory and Cpus setting(only for virtualbox)
##########################################
zk_mem : 256
master_mem: 256
slave_mem : 256
zk_mem : 256
zk_cpus : 1
master_mem : 256
master_cpus: 1
slave_mem : 512
slave_cpus : 2

# private ip bases
# When ec2, this should be matched with
Expand Down
14 changes: 10 additions & 4 deletions multinodes/lib/gen_node_infos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,42 @@
def gen_node_infos(cluster_yml)
master_n = cluster_yml['master_n']
master_mem = cluster_yml['master_mem']
master_cpus = cluster_yml['master_cpus']
slave_n = cluster_yml['slave_n']
slave_mem = cluster_yml['slave_mem']
slave_cpus = cluster_yml['slave_cpus']
zk_n = cluster_yml['zk_n']
zk_mem = cluster_yml['zk_mem']
zk_cpus = cluster_yml['zk_cpus']
master_ipbase = cluster_yml['master_ipbase']
slave_ipbase = cluster_yml['slave_ipbase']
zk_ipbase = cluster_yml['zk_ipbase']
zk_instance_type = cluster_yml['zk_instance_type']
master_instance_type = cluster_yml['master_instance_type']
slave_instance_type = cluster_yml['slave_instance_type']

master_infos = (1..master_n).map do |i|
{ :hostname => "master#{i}",
:ip => master_ipbase + "#{10+i}",
:mem => master_mem,
:instance_type => master_instance_type
:cpus => master_cpus,
:instance_type => master_instance_type
}
end
slave_infos = (1..slave_n).map do |i|
{ :hostname => "slave#{i}",
:ip => slave_ipbase + "#{10+i}",
:mem => slave_mem,
:instance_type => slave_instance_type
:cpus => slave_cpus,
:instance_type => slave_instance_type
}
end
zk_infos = (1..zk_n).map do |i|
{ :hostname => "zk#{i}",
:ip => zk_ipbase + "#{10+i}",
:mem => zk_mem,
:instance_type => zk_instance_type
:cpus => zk_cpus,
:instance_type => zk_instance_type
}
end

Expand Down

0 comments on commit 8ee71da

Please sign in to comment.