:name => 'my cluster',
# If the polling interval is omitted, 15sec is asssumed.
:polling_interval => '',
- # 'address1:port addreses2:port ...'
- :address_list => 'localhost'
+ # ['address1:port', 'addreses2:port', ...]
+ :address_list => ['localhost']
}
]
default['ganglia']['gridname'] = 'MyGrid'
-# e.g. '127.0.0.1 169.229.50.165 my.gmetad.org'
-default['ganglia']['trusted_hosts'] = ''
+# e.g. ['127.0.0.1', '169.229.50.165', 'my.gmetad.org']
+default['ganglia']['trusted_hosts'] = []
# gmond.conf
default['ganglia']['cluster']['name'] = 'unspecified'
default['ganglia']['cluster']['owner'] = 'unspecified'
default['ganglia']['cluster']['latlong'] = 'unspecified'
default['ganglia']['cluster']['url'] = 'unspecified'
default['ganglia']['host']['location'] = 'unspecified'
-# multi-cast (default)
+## 1. multi-cast (default)
default['ganglia']['udp_send_channels'] = [
{
'mcast_join' => '239.2.11.71',
'port' => '8649'
}
]
+=begin
+## 2. e.g. uni-cast
+default['ganglia']['udp_send_channels'] = [
+ {
+ 'mcast_join' => '',
+ 'host' => 'localhost',
+ 'port' => '8649',
+ 'ttl' => ''
+ }
+]
+default['ganglia']['udp_recv_channels'] = [
+ {
+ 'mcast_join' => '',
+ 'port' => '8649',
+ 'bind' => ''
+ }
+]
+=end
+## 3. automatic unicast setup for huge cluster (e.g. Hadoop DataNodes)
+# if huge_cluster_unicast.enabled, udp_send_channels and udp_recv_channels have no effect.
+default['ganglia']['huge_cluster_unicast'] = {
+ 'enabled' => false,
+ 'domain' => 'grid.example.com',
+ 'node_prefix' => 'dn',
+ 'digit_nums' => '5', # dn#####
+ 'padstr' => '0', # dn00000
+ 'first_node_num' => '0', # 1st node: dn00000.grid.example.com
+ 'last_node_num' => '999',# last node: dn00999.grid.example.com
+ 'head_node_nums' => '2', # heads of the 1st cluster: dn0000{0..1}.grid.example.com
+ 'cluster_size' => '40', # heads of the 2nd cluster: dn0004{0..1}.grid.example.com
+ 'port' => '8649'
+}
# ganglia-web
## default: white list
default['ganglia']['web']['Order'] = 'Deny,Allow'
default['ganglia']['web']['mod_auth_kerb']['KrbMethodK5Passwd'] = 'off'
#default['ganglia']['']
-=begin
-# e.g. uni-cast
-default['ganglia']['udp_send_channels'] = [
- {
- 'mcast_join' => '',
- 'host' => 'localhost',
- 'port' => '8649',
- 'ttl' => '1'
- }
-]
-default['ganglia']['udp_recv_channels'] = [
- {
- 'mcast_join' => '',
- 'port' => '8649',
- 'bind' => ''
- }
-]
-=end
# ttl = 1
#}
<%
-node['ganglia']['udp_send_channels'].each do |channel|
+huge_cluster_unicast = node['ganglia']['huge_cluster_unicast']
+if huge_cluster_unicast['enabled'] then
+ this_node = node[:fqdn]
+ this_domain = huge_cluster_unicast['domain']
+ node_prefix = huge_cluster_unicast['node_prefix']
+ head_node_nums = huge_cluster_unicast['head_node_nums'].to_i
+ digit_nums = huge_cluster_unicast['digit_nums'].to_i
+ padstr = huge_cluster_unicast['padstr']
+ first_node_num = huge_cluster_unicast['first_node_num'].to_i
+ last_node_num = huge_cluster_unicast['last_node_num'].to_i
+ cluster_size = huge_cluster_unicast['cluster_size'].to_i
+
+ head_nodes = []
+ (first_node_num..last_node_num).step(cluster_size) do |i|
+ first_head = node_prefix + i.to_s.rjust(digit_nums, padstr) + ".#{this_domain}"
+ next_first_head = node_prefix + (i + cluster_size).to_s.rjust(digit_nums, padstr) + ".#{this_domain}"
+ if first_head <= this_node \
+ && this_node < next_first_head then
+ (i...(i + head_node_nums)).each do |j|
+ head_nodes.push(node_prefix + j.to_s.rjust(digit_nums, padstr) + ".#{this_domain}")
+ end
+ break
+ end
+ end
+
+ head_nodes.each do |fqdn|
+-%>
+udp_send_channel {
+ host = <%= fqdn %>
+ port = <%= node['ganglia']['huge_cluster_unicast']['port'] %>
+}
+<%
+ end
+else
+ node['ganglia']['udp_send_channels'].each do |channel|
-%>
udp_send_channel {
<%
- mcast_join = channel['mcast_join']
- if !mcast_join.nil? && !mcast_join.empty? then
+ mcast_join = channel['mcast_join']
+ if !mcast_join.nil? && !mcast_join.empty? then
-%>
mcast_join = <%= mcast_join %>
<%
- end
+ end
-%>
<%
- host = channel['host']
- if !host.nil? && !host.empty? then
+ host = channel['host']
+ if !host.nil? && !host.empty? then
-%>
host = <%= host %>
<%
- end
+ end
-%>
port = <%= channel['port'] %>
+<%
+ ttl = channel['ttl']
+ if !ttl.nil? && !ttl.empty? then
+-%>
ttl = <%= channel['ttl'] %>
+<%
+ end
+-%>
}
<%
+ end
end
-%>
/* You can specify as many udp_recv_channels as you like as well. */
<%
-node['ganglia']['udp_recv_channels'].each do |channel|
+if node['ganglia']['huge_cluster_unicast']['enabled'] then
-%>
udp_recv_channel {
+ port = <%= node['ganglia']['huge_cluster_unicast']['port'] %>
+}
<%
- mcast_join = channel['mcast_join']
- if !mcast_join.nil? && !mcast_join.empty? then
+else
+ node['ganglia']['udp_recv_channels'].each do |channel|
+-%>
+udp_recv_channel {
+<%
+ mcast_join = channel['mcast_join']
+ if !mcast_join.nil? && !mcast_join.empty? then
-%>
mcast_join = <%= mcast_join %>
<%
- end
+ end
-%>
port = <%= channel['port'] %>
<%
- bind = channel['bind']
- if !bind.nil? && !bind.empty? then
+ bind = channel['bind']
+ if !bind.nil? && !bind.empty? then
-%>
bind = <%= bind %>
<%
- end
+ end
-%>
}
<%
+ end
end
-%>
/* Feel free to specify as many udp_send_channels as you like. Gmond
used to only support having a single channel */
<%
-node['ganglia']['udp_send_channels'].each do |channel|
+huge_cluster_unicast = node['ganglia']['huge_cluster_unicast']
+if huge_cluster_unicast['enabled'] then
+ this_node = node[:fqdn]
+ this_domain = huge_cluster_unicast['domain']
+ node_prefix = huge_cluster_unicast['node_prefix']
+ head_node_nums = huge_cluster_unicast['head_node_nums'].to_i
+ digit_nums = huge_cluster_unicast['digit_nums'].to_i
+ padstr = huge_cluster_unicast['padstr']
+ first_node_num = huge_cluster_unicast['first_node_num'].to_i
+ last_node_num = huge_cluster_unicast['last_node_num'].to_i
+ cluster_size = huge_cluster_unicast['cluster_size'].to_i
+
+ head_nodes = []
+ (first_node_num..last_node_num).step(cluster_size) do |i|
+ first_head = node_prefix + i.to_s.rjust(digit_nums, padstr) + ".#{this_domain}"
+ next_first_head = node_prefix + (i + cluster_size).to_s.rjust(digit_nums, padstr) + ".#{this_domain}"
+ if first_head <= this_node \
+ && this_node < next_first_head then
+ (i...(i + head_node_nums)).each do |j|
+ head_nodes.push(node_prefix + j.to_s.rjust(digit_nums, padstr) + ".#{this_domain}")
+ end
+ break
+ end
+ end
+
+ head_nodes.each do |fqdn|
+-%>
+udp_send_channel {
+ host = <%= fqdn %>
+ port = <%= node['ganglia']['huge_cluster_unicast']['port'] %>
+}
+<%
+ end
+else
+ node['ganglia']['udp_send_channels'].each do |channel|
-%>
udp_send_channel {
<%
- mcast_join = channel['mcast_join']
- if !mcast_join.nil? && !mcast_join.empty? then
+ mcast_join = channel['mcast_join']
+ if !mcast_join.nil? && !mcast_join.empty? then
-%>
mcast_join = <%= mcast_join %>
<%
end
-%>
<%
- host = channel['host']
- if !host.nil? && !host.empty? then
+ host = channel['host']
+ if !host.nil? && !host.empty? then
-%>
host = <%= host %>
<%
- end
+ end
-%>
port = <%= channel['port'] %>
+<%
+ ttl = channel['ttl']
+ if !ttl.nil? && !ttl.empty? then
+-%>
ttl = <%= channel['ttl'] %>
+<%
+ end
+-%>
}
<%
+ end
end
-%>
/* You can specify as many udp_recv_channels as you like as well. */
<%
-node['ganglia']['udp_recv_channels'].each do |channel|
+if node['ganglia']['huge_cluster_unicast']['enabled'] then
+-%>
+udp_recv_channel {
+ port = <%= node['ganglia']['huge_cluster_unicast']['port'] %>
+}
+<%
+else
+ node['ganglia']['udp_recv_channels'].each do |channel|
-%>
udp_recv_channel {
<%
- mcast_join = channel['mcast_join']
- if !mcast_join.nil? && !mcast_join.empty? then
+ mcast_join = channel['mcast_join']
+ if !mcast_join.nil? && !mcast_join.empty? then
-%>
mcast_join = <%= mcast_join %>
<%
- end
+ end
-%>
port = <%= channel['port'] %>
<%
- bind = channel['bind']
- if !bind.nil? && !bind.empty? then
+ bind = channel['bind']
+ if !bind.nil? && !bind.empty? then
-%>
bind = <%= bind %>
<%
- end
+ end
-%>
-}
+}
<%
-end
+ end
+end
-%>
/* You can specify as many tcp_accept_channels as you like to share
action :create
end
- package 'tar' do
+ pkg = 'tar'
+ resources(:package => pkg) rescue package pkg do
action :install
end
- bash "install hadoop: #{install_root}" do
+ bash "install_hadoop-#{version}" do
code <<-EOC
tar xvzf #{downloaded_tarball} -C #{node['grid']['app_root']}
EOC
{
:name => 'local',
:polling_interval => '',
- :address_list => 'localhost'
+ :address_list => ['localhost']
}
],
'gridname' => 'Test'
'mcast_join' => '',
'host' => 'localhost',
'port' => '8649',
- 'ttl' => '1'
+ 'ttl' => ''
}
],
'udp_recv_channels' => [
-name 'pleiades-dn00'
-description 'Pleiades DataNode00 node'
+name 'pleiades-dn'
+description 'Pleiades DataNode node'
run_list(
'role[grid-realm]',
'name' => 'DataNode00',
'owner' => 'grid.example.com'
},
+ # multi-cast
'udp_send_channels' => [
{
'mcast_join' => mcast_addr,
'bind' => mcast_addr
}
]
+=begin
+ ## uni-cast
+ 'huge_cluster_unicast' = {
+ 'enabled' => false,
+ 'domain' => 'grid.example.com',
+ 'node_prefix' => 'dn',
+ 'digit_nums' => '5', # dn#####
+ 'padstr' => '0', # dn00000
+ 'first_node_num' => '0', # 1st node: dn00000.grid.example.com
+ 'last_node_num' => '999',# last node: dn00999.grid.example.com
+ 'head_node_nums' => '2', # heads of the 1st cluster: dn0000{0..1}.grid.example.com
+ 'cluster_size' => '40', # heads of the 2nd cluster: dn0004{0..1}.grid.example.com
+ 'port' => '8649'
+ }
+=end
}
)
mcast_addr = '239.2.11.3'
port = '8649'
polling_interval = '30'
+# for DataNode
+head_node_nums = 2
+digit_nums = 5
+padstr = '0'
+dn_data_sources = []
+(0...2).step(40) {|v|
+#(0...80).step(40) {|v|
+ first_head = v.to_s.rjust(digit_nums, padstr)
+ last_head = (v + head_node_nums -1).to_s.rjust(digit_nums, padstr)
+ dn_data_sources.push(
+ {
+ :name => "DataNode#{first_head}",
+ :polling_interval => polling_interval,
+ :address_list => "dn{#{first_head}..#{last_head}}.#{this_domain}".expand
+ }
+ )
+}
#env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"], "_default" => []
'name' => 'Ganglia',
'owner' => this_domain
},
+ ## multicast
'udp_send_channels' => [
{
'mcast_join' => mcast_addr,
'bind' => mcast_addr
}
],
+=begin
+ ## unicast
+ 'udp_send_channels' => [
+ {
+ 'mcast_join' => '',
+ 'host' => "gm00.#{this.domain}",
+ 'port' => port,
+ 'ttl' => ''
+ },
+ {
+ 'mcast_join' => '',
+ 'host' => "gm01.#{this.domain}",
+ 'port' => port,
+ 'ttl' => ''
+ }
+ ],
+ 'udp_recv_channels' => [
+ {
+ 'mcast_join' => '',
+ 'port' => port,
+ 'bind' => ''
+ }
+ ],
+=end
# gmetad
'gridname' => 'Pleiades',
'trusted_hosts' => ['127.0.0.1'] + "nm0{0..1}.#{this_domain}".expand,
:polling_interval => polling_interval,
:address_list => "rm0{0..1}.#{this_domain}".expand
},
- {
- :name => 'DataNode00',
- :polling_interval => polling_interval,
- :address_list => "dn0000{0..1}.#{this_domain}".expand
- }
- ]
+ ] + dn_data_sources
}
)
'bind' => mcast_addr
}
]
+=begin
+ ## unicast
+ 'udp_send_channels' => [
+ {
+ 'mcast_join' => '',
+ 'host' => "gw00.#{this.domain}",
+ 'port' => port,
+ 'ttl' => ''
+ },
+ {
+ 'mcast_join' => '',
+ 'host' => "gw01.#{this.domain}",
+ 'port' => port,
+ 'ttl' => ''
+ }
+ ],
+ 'udp_recv_channels' => [
+ {
+ 'mcast_join' => '',
+ 'port' => port,
+ 'bind' => ''
+ }
+ ]
+=end
},
'pig' => {
'version' => '0.11.1'
'bind' => mcast_addr
}
]
+=begin
+ ## unicast
+ 'udp_send_channels' => [
+ {
+ 'mcast_join' => '',
+ 'host' => "jt00.#{this.domain}",
+ 'port' => port,
+ 'ttl' => ''
+ },
+ {
+ 'mcast_join' => '',
+ 'host' => "jt01.#{this.domain}",
+ 'port' => port,
+ 'ttl' => ''
+ }
+ ],
+ 'udp_recv_channels' => [
+ {
+ 'mcast_join' => '',
+ 'port' => port,
+ 'bind' => ''
+ }
+ ]
+=end
}
)
'bind' => mcast_addr
}
]
+=begin
+ ## unicast
+ 'udp_send_channels' => [
+ {
+ 'mcast_join' => '',
+ 'host' => "nm00.#{this.domain}",
+ 'port' => port,
+ 'ttl' => ''
+ },
+ {
+ 'mcast_join' => '',
+ 'host' => "nm01.#{this.domain}",
+ 'port' => port,
+ 'ttl' => ''
+ }
+ ],
+ 'udp_recv_channels' => [
+ {
+ 'mcast_join' => '',
+ 'port' => port,
+ 'bind' => ''
+ }
+ ]
+=end
}
)
'bind' => mcast_addr
}
]
+=begin
+ ## unicast
+ 'udp_send_channels' => [
+ {
+ 'mcast_join' => '',
+ 'host' => "nn00.#{this.domain}",
+ 'port' => port,
+ 'ttl' => ''
+ },
+ {
+ 'mcast_join' => '',
+ 'host' => "nn01.#{this.domain}",
+ 'port' => port,
+ 'ttl' => ''
+ }
+ ],
+ 'udp_recv_channels' => [
+ {
+ 'mcast_join' => '',
+ 'port' => port,
+ 'bind' => ''
+ }
+ ]
+=end
}
)
'bind' => mcast_addr
}
]
+=begin
+ ## unicast
+ 'udp_send_channels' => [
+ {
+ 'mcast_join' => '',
+ 'host' => "pxy00.#{this.domain}",
+ 'port' => port,
+ 'ttl' => ''
+ },
+ {
+ 'mcast_join' => '',
+ 'host' => "pxy01.#{this.domain}",
+ 'port' => port,
+ 'ttl' => ''
+ }
+ ],
+ 'udp_recv_channels' => [
+ {
+ 'mcast_join' => '',
+ 'port' => port,
+ 'bind' => ''
+ }
+ ]
+=end
}
)
'bind' => mcast_addr
}
]
+=begin
+ ## unicast
+ 'udp_send_channels' => [
+ {
+ 'mcast_join' => '',
+ 'host' => "wf00.#{this.domain}",
+ 'port' => port,
+ 'ttl' => ''
+ },
+ {
+ 'mcast_join' => '',
+ 'host' => "wf01.#{this.domain}",
+ 'port' => port,
+ 'ttl' => ''
+ }
+ ],
+ 'udp_recv_channels' => [
+ {
+ 'mcast_join' => '',
+ 'port' => port,
+ 'bind' => ''
+ }
+ ]
+=end
}
)
run_list(
'role[mocker]',
+ 'role[chef_utils]',
'role[ganglia-gmond-ucast-localhost]',
'role[ganglia-gmetad-localhost]',
'role[ganglia-web]',
}
},
'ganglia' => {
- 'trusted_hosts' => '127.0.0.1',
+ 'trusted_hosts' => ['127.0.0.1'],
'web' => {
#'Allow' => ['from .grid.example.com'],
'AuthType' => 'Kerberos',
}
)
-#override_attributes "apache2" => { "max_children" => "50" }
+override_attributes(
+ 'ganglia' => {
+ 'trusted_hosts' => ['127.0.0.1'],
+ # for TEST
+ #'huge_cluster_unicast' => {
+ # 'enabled' => true
+ #}
+ }
+)
+