OSDN Git Service

adds SSL configurations.
[metasearch/grid-chef-repo.git] / roles / ptolemy-nn.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 require 'socket'
21
22 cluster_name = 'ptolemy'
23 cluster_sym = cluster_name.to_sym
24
25 name "#{cluster_name}-nn"
26 description "#{cluster_name.capitalize} NameNode node"
27
28 run_list(
29   'role[node_commons]',
30   #'role[grid-realm]',
31   'role[ganglia-gmond]',
32   "role[#{cluster_name}-node]"
33 )
34
35 #env_run_lists()
36
37 this_subcluster = Grid::CLUSTERS[cluster_sym][:namenodes]
38 mcast_addr = this_subcluster[:mcast_addr]
39 port = '8649'
40 # uni-cast
41 udp_send_channels4ucast = []
42 this_subcluster[:nodes].first(2).each {|host|
43   udp_send_channels4ucast.push(
44     {
45       'mcast_join' => '',
46       'host' => "#{host}.#{Grid::DOMAIN}",
47       #'host' => IPSocket.getaddress("#{host}.#{Grid::DOMAIN}"),
48       'port' => port,
49       'ttl' => ''
50     }
51   )
52 }
53
54 default_attributes(
55 )
56
57 override_attributes(
58   'ganglia' => {
59     # gmond
60     'cluster' => {
61       'name' => this_subcluster[:alias],
62       'owner' => Grid::DOMAIN
63     },
64     'static' => {
65 =begin
66       ## static multi-cast
67       'udp_send_channels' => [
68         {
69           'mcast_join' => mcast_addr,
70           'host' => '',
71           'port' => port,
72           'ttl' => '1'
73         }
74       ],
75       'udp_recv_channels' => [
76         {
77           'mcast_join' => mcast_addr,
78           'port' => port,
79           'bind' => mcast_addr
80         }
81       ]
82 =end
83       ## static uni-cast
84       'udp_send_channels' => udp_send_channels4ucast,
85       'udp_recv_channels' => [
86         {
87           'mcast_join' => '',
88           'port' => port,
89           'bind' => ''
90         }
91       ]
92     }
93   }
94 )