OSDN Git Service

docker-grid-0.1.0
[metasearch/grid-chef-repo.git] / roles / praesepe-dn.rb
1 #
2 # Copyright 2013-2014, whitestar
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16
17 $LOAD_PATH.push("#{File.dirname(__FILE__)}/_lib")
18 #${chef-repo}/roles/_lib/grid.rb
19 require 'grid'
20
21 cluster_name = 'praesepe'
22 cluster_sym = cluster_name.to_sym
23 datanode_prefix = 'dn1'
24 datanode_digit_nums = '4'
25
26 name "#{cluster_name}-dn"
27 description "#{cluster_name.capitalize} DataNode node"
28
29 run_list(
30   'role[node_commons]',
31   #'role[grid-realm]',
32   'role[ganglia-gmond]',
33   "role[#{cluster_name}-node]"
34 )
35
36 #env_run_lists()
37
38 mcast_addr = Grid::CLUSTERS[cluster_sym][:datanodes][:mcast_addr]
39 port = '8649'
40
41 default_attributes(
42 )
43
44 override_attributes(
45   'ganglia' => {
46     # gmond
47     'cluster' => {
48       'name' => 'DataNode00000',
49       'owner' => Grid::DOMAIN
50     },
51 =begin
52     ## static multi-cast
53     'static' => {
54       'udp_send_channels' => [
55         {
56           'mcast_join' => mcast_addr,
57           'host' => '',
58           'port' => port,
59           'ttl' => '1'
60         }
61       ],
62       'udp_recv_channels' => [
63         {
64           'mcast_join' => mcast_addr,
65           'port' => port,
66           'bind' => mcast_addr
67         }
68       ]
69     }
70 =end
71     ## automatic multi/uni-cast
72     'gmond_conf_type' => 'automatic',
73     'automatic' => {
74       'cluster_name_prefix' => 'DataNode', # DataNode#####
75       'cast_mode' => 'uni',                # or multi
76       'domain' => Grid::DOMAIN,
77       #'node_prefix' => 'dn',
78       'node_prefix' => datanode_prefix,
79       #'digit_nums' => '5',                 # dn#####
80       'digit_nums' => datanode_digit_nums,  # dn4####
81       'padstr' => '0',           # dn00000
82       'first_node_num' => '0',   # 1st node:  dn00000.grid.example.com
83       #'last_node_num'  => '999', # last node: dn00999.grid.example.com
84       'last_node_num'  => '1', # last node: dn40001.grid.example.com
85       'head_node_nums' => '2',   # heads of the 1st cluster: dn0000{0..1}.grid.example.com
86       'cluster_size' => '40',    # heads of the 2nd cluster: dn0004{0..1}.grid.example.com
87       'mcast_join' => mcast_addr, # multi-cast mode only
88       'port' => port,
89       'ttl' => '1',              # multi-cast mode only
90       'bind' => mcast_addr       # multi-cast mode only
91     }
92   }
93 )