OSDN Git Service

refactor roles for the Ptolemy cluster.
authorwhitestar <whitestar@gaea.test>
Sat, 28 Dec 2013 08:21:45 +0000 (17:21 +0900)
committerwhitestar <whitestar@gaea.test>
Sat, 28 Dec 2013 08:21:45 +0000 (17:21 +0900)
_lib/grid.rb
cookbooks/hadoop/attributes/default.rb
roles/hadoop-ptolemy.rb
roles/pleiades-gm.rb
roles/ptolemy-dn.rb
roles/ptolemy-gm.rb
roles/ptolemy-jt.rb
roles/ptolemy-nn.rb
roles/ptolemy-node.rb

index a75f686..ef40db8 100644 (file)
@@ -178,10 +178,10 @@ module Grid
         :mcast_addr => '239.2.11.20'
       }
     },
-    :praesepe => {
-    },
     :hyades => {
     },
+    :praesepe => {
+    },
     :ptolemy => {
       :gmetads => {
         :name => 'gmetads',
index 580d9ad..70830b7 100644 (file)
@@ -415,7 +415,14 @@ default['hadoop']['extra_configs'] = {
     #'truenode.max.xcievers' => '4096'
   },
   'yarn-site.xml' => {},  # ver. 2.0
-  'mapred-site.xml' => {},
+  'mapred-site.xml' => {
+    #'mapred.tasktracker.map.tasks.maximum' => '4',     # default: 2
+    #'mapred.tasktracker.reduce.tasks.maximum' => '2',  # default: 2
+    #'mapred.child.java.opts' => '-Xmx1000m',           # default: -Xmx200m
+    #'mapred.reduce.slowstart.completed.maps' => '0.80',  # default: 0.05
+    #'tasktracker.http.threads' => '80',                  # default: 40
+    #'mapred.reduce.parallel.copies' => SQRT(nodes)       # default: 5
+  },
   'capacity-scheduler.xml' => {},
 }
 #default['hadoop'][''] = 
index 60b1d5b..1dffb43 100644 (file)
@@ -1,5 +1,12 @@
-name 'hadoop-ptolemy'
-description 'Pleiades Hadoop cluster node'
+$LOAD_PATH.push("#{File.dirname(__FILE__)}/../_lib")
+#${chef-repo}/_lib/grid.rb
+require 'grid'
+
+cluster_name = 'ptolemy'
+cluster_sym = cluster_name.to_sym
+
+name "hadoop-#{cluster_name}"
+description "#{cluster_name.capitalize} Hadoop cluster node"
 
 run_list(
   'role[node_commons]',
@@ -13,8 +20,8 @@ run_list(
 grid_vol_root = '/grid/vol'
 hadoop_attributes = {
   # core-site.xml
-  'this.cluster.name' => 'ptolemy'
-  'this.domain' => 'grid.example.com',
+  'this.cluster.name' => cluster_name
+  'this.domain' => Grid::DOMAIN,
   'this.namenode.fqdn' => '${this.cluster.name}-nn.${this.domain}',
   'fs.checkpoint.dir' => "#{grid_vol_root}/0/var/lib/${user.name}/checkpoint",
   #'fs.checkpoint.dir' => "#{grid_vol_root}/0/var/lib/${user.name}/checkpoint,/export/home/${user.name}/var/lib/checkpoint",
@@ -28,6 +35,28 @@ hadoop_attributes = {
   'this.jobtracker.fqdn' => '${this.cluster.name}-jt.${this.domain}',
   'this.jobhistory.fqdn' => '${this.cluster.name}-jt.${this.domain}',
   #'this.jobhistory.fqdn' => '${this.cluster.name}-jh.${this.domain}',
+  'extra_configs' => {
+    # e.g. 'core-site.xml' => {'k1' => 'v1', 'k2' => 'v2'},
+    'hadoop-env.sh' => {},
+    'yarn-env.sh' => {},  # ver. 2.0
+    'mapred-env.sh' => {},  # ver. 2.0
+    'core-site.xml' => {},
+    'hdfs-site.xml' => {
+      # with HBase
+      #'dfs.support.append' => 'true',
+      #'truenode.max.xcievers' => '4096'
+    },
+    'yarn-site.xml' => {},  # ver. 2.0
+    'mapred-site.xml' => {
+      #'mapred.tasktracker.map.tasks.maximum' => '4',     # default: 2
+      #'mapred.tasktracker.reduce.tasks.maximum' => '2',  # default: 2
+      #'mapred.child.java.opts' => '-Xmx1000m',           # default: -Xmx200m
+      #'mapred.reduce.slowstart.completed.maps' => '0.80',  # default: 0.05
+      #'tasktracker.http.threads' => '80',                  # default: 40
+      #'mapred.reduce.parallel.copies' => SQRT(nodes)       # default: 5
+    },
+    'capacity-scheduler.xml' => {}
+  }
 }
 
 default_attributes(
index 07708bc..0747910 100644 (file)
@@ -4,8 +4,11 @@ require 'grid'
 require 'rubygems'
 require 'bracecomp'
 
-name 'pleiades-gm'
-description 'Pleiades ganglia gmetad node'
+cluster_name = 'pleiades'
+cluster_sym = cluster_name.to_sym
+
+name "#{cluster_name}-gm"
+description "#{cluster_name.capitalize} ganglia gmetad node"
 
 run_list(
   'role[node_commons]',
@@ -17,7 +20,7 @@ run_list(
 
 #env_run_lists()
 
-this_subcluster = Grid::CLUSTERS[:pleiades][:gmetads]
+this_subcluster = Grid::CLUSTERS[cluster_sym][:gmetads]
 mcast_addr = this_subcluster[:mcast_addr]
 port = '8649'
 polling_interval = '30'
@@ -38,7 +41,7 @@ this_subcluster[:nodes].first(2).each {|host|
 
 # for non-DataNodes
 data_sources = []
-Grid::CLUSTERS[:pleiades].select{|key| key != :datanodes}.each {|key, cluster|
+Grid::CLUSTERS[cluster_sym].select{|key| key != :datanodes}.each {|key, cluster|
   data_sources.push(
     {
       :name => cluster[:alias],
@@ -82,6 +85,11 @@ default_attributes(
   },
 )
 
+nagios_nodes = []
+if defined? Grid::CLUSTERS[cluster_sym][:nagioses][:nodes] then
+  nagios_nodes = Grid::CLUSTERS[cluster_sym][:nagioses][:nodes].map{|host| "#{host}.#{Grid::DOMAIN}"}
+end
+
 override_attributes(
   'ganglia' => {
     # gmond
@@ -120,8 +128,7 @@ override_attributes(
     },
     # gmetad
     'gridname' => 'Pleiades',
-    'trusted_hosts' => ['127.0.0.1'] \
-      + Grid::CLUSTERS[:pleiades][:nagioses][:nodes].map{|host| "#{host}.#{Grid::DOMAIN}"},
+    'trusted_hosts' => ['127.0.0.1'] + nagios_nodes,
     'data_sources' => data_sources + dn_data_sources
   }
 )
index 30fb1f1..9a08a78 100644 (file)
@@ -2,19 +2,22 @@ $LOAD_PATH.push("#{File.dirname(__FILE__)}/../_lib")
 #${chef-repo}/_lib/grid.rb
 require 'grid'
 
-name 'ptolemy-dn'
-description 'Ptolemy DataNode node'
+cluster_name = 'ptolemy'
+cluster_sym = cluster_name.to_sym
+
+name "#{cluster_name}-dn"
+description "#{cluster_name.capitalize} DataNode node"
 
 run_list(
   'role[node_commons]',
   #'role[grid-realm]',
   'role[ganglia-gmond]',
-  'role[ptolemy-node]'
+  "role[#{cluster_name}-node]"
 )
 
 #env_run_lists()
 
-mcast_addr = Grid::CLUSTERS[:ptolemy][:datanodes][:mcast_addr]
+mcast_addr = Grid::CLUSTERS[cluster_sym][:datanodes][:mcast_addr]
 port = '8649'
 
 default_attributes(
@@ -27,6 +30,7 @@ override_attributes(
       'name' => 'DataNode00000',
       'owner' => Grid::DOMAIN
     },
+=begin
     ## static multi-cast
     'static' => {
       'udp_send_channels' => [
@@ -45,25 +49,27 @@ override_attributes(
         }
       ]
     }
-=begin
+=end
     ## automatic multi/uni-cast
     'gmond_conf_type' => 'automatic',
-    'automatic' = {
+    'automatic' => {
       'cluster_name_prefix' => 'DataNode', # DataNode#####
       'cast_mode' => 'uni',                # or multi
-      'domain' => 'grid.example.com',
-      'node_prefix' => 'dn',
-      'digit_nums' => '5',       # dn#####
+      'domain' => Grid::DOMAIN,
+      #'node_prefix' => 'dn',
+      'node_prefix' => 'dn4',
+      #'digit_nums' => '5',       # dn#####
+      'digit_nums' => '4',       # dn4####
       'padstr' => '0',           # dn00000
       'first_node_num' => '0',   # 1st node:  dn00000.grid.example.com
-      'last_node_num'  => '999', # last node: dn00999.grid.example.com
+      #'last_node_num'  => '999', # last node: dn00999.grid.example.com
+      'last_node_num'  => '1', # last node: dn40001.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
       'mcast_join' => mcast_addr, # multi-cast mode only
       'port' => port,
       'ttl' => '1',              # multi-cast mode only
-      'bind' => '239.2.11.71'    # multi-cast mode only
+      'bind' => mcast_addr       # multi-cast mode only
     }
-=end
   }
 )
index 8b50b46..7dc7d20 100644 (file)
@@ -4,8 +4,11 @@ require 'grid'
 require 'rubygems'
 require 'bracecomp'
 
-name 'ptolemy-gm'
-description 'Ptolemy ganglia gmetad node'
+cluster_name = 'ptolemy'
+cluster_sym = cluster_name.to_sym
+
+name "#{cluster_name}-gm"
+description "#{cluster_name.capitalize} ganglia gmetad node"
 
 run_list(
   'role[node_commons]',
@@ -17,11 +20,10 @@ run_list(
 
 #env_run_lists()
 
-this_subcluster = Grid::CLUSTERS[:ptolemy][:gmetads]
+this_subcluster = Grid::CLUSTERS[cluster_sym][:gmetads]
 mcast_addr = this_subcluster[:mcast_addr]
 port = '8649'
 polling_interval = '30'
-=begin
 # uni-cast
 udp_send_channels4ucast = []
 this_subcluster[:nodes].first(2).each {|host|
@@ -34,11 +36,10 @@ this_subcluster[:nodes].first(2).each {|host|
     }
   )
 }
-=end
 
 # for non-DataNodes
 data_sources = []
-Grid::CLUSTERS[:ptolemy].select{|key| key != :datanodes}.each {|key, cluster|
+Grid::CLUSTERS[cluster_sym].select{|key| key != :datanodes}.each {|key, cluster|
   data_sources.push(
     {
       :name => cluster[:alias],
@@ -51,7 +52,7 @@ Grid::CLUSTERS[:ptolemy].select{|key| key != :datanodes}.each {|key, cluster|
 
 # for DataNodes
 head_node_nums = 2
-digit_nums = 5
+digit_nums = 4
 padstr = '0'
 dn_data_sources = []
 (0...2).step(40) {|v|
@@ -62,7 +63,8 @@ dn_data_sources = []
     {
       :name => "DataNode#{first_head}",
       :polling_interval => polling_interval,
-      :address_list => "dn{#{first_head}..#{last_head}}.#{Grid::DOMAIN}".expand
+      # dn40000
+      :address_list => "dn4{#{first_head}..#{last_head}}.#{Grid::DOMAIN}".expand
     }
   )
 }
@@ -84,6 +86,11 @@ default_attributes(
   },
 )
 
+nagios_nodes = []
+if defined? Grid::CLUSTERS[cluster_sym][:nagioses][:nodes] then
+  nagios_nodes = Grid::CLUSTERS[cluster_sym][:nagioses][:nodes].map{|host| "#{host}.#{Grid::DOMAIN}"}
+end
+
 override_attributes(
   'ganglia' => {
     # gmond
@@ -91,8 +98,9 @@ override_attributes(
       'name' => this_subcluster[:alias],
       'owner' => Grid::DOMAIN
     },
-    ## static multi-cast
     'static' => {
+=begin
+      ## static multi-cast
       'udp_send_channels' => [
         {
           'mcast_join' => mcast_addr,
@@ -108,7 +116,7 @@ override_attributes(
           'bind' => mcast_addr
         }
       ],
-=begin
+=end
       ## static uni-cast
       'udp_send_channels' => udp_send_channels4ucast,
       'udp_recv_channels' => [
@@ -118,13 +126,10 @@ override_attributes(
           'bind' => ''
         }
       ],
-=end
     },
     # gmetad
-    'gridname' => 'Ptolemy',
-    'trusted_hosts' => ['127.0.0.1'],
-    #'trusted_hosts' => ['127.0.0.1'] \
-    #  + Grid::CLUSTERS[:ptolemy][:nagioses][:nodes].map{|host| "#{host}.#{Grid::DOMAIN}"},
+    'gridname' => cluster_name.capitalize,
+    'trusted_hosts' => ['127.0.0.1'] + nagios_nodes,
     'data_sources' => data_sources + dn_data_sources
   }
 )
index 8c452cc..9e52e77 100644 (file)
@@ -2,22 +2,24 @@ $LOAD_PATH.push("#{File.dirname(__FILE__)}/../_lib")
 #${chef-repo}/_lib/grid.rb
 require 'grid'
 
-name 'ptolemy-jt'
-description 'Ptolemy JobTracker node'
+cluster_name = 'ptolemy'
+cluster_sym = cluster_name.to_sym
+
+name "#{cluster_name}-jt"
+description "#{cluster_name.capitalize} JobTracker node"
 
 run_list(
   'role[node_commons]',
   #'role[grid-realm]',
   'role[ganglia-gmond]',
-  'role[ptolemy-node]'
+  "role[#{cluster_name}-node]"
 )
 
 #env_run_lists()
 
-this_subcluster = Grid::CLUSTERS[:ptolemy][:jobtrackers]
+this_subcluster = Grid::CLUSTERS[cluster_sym][:jobtrackers]
 mcast_addr = this_subcluster[:mcast_addr]
 port = '8649'
-=begin
 # uni-cast
 udp_send_channels4ucast = []
 this_subcluster[:nodes].first(2).each {|host|
@@ -30,7 +32,6 @@ this_subcluster[:nodes].first(2).each {|host|
     }
   )
 }
-=end
 
 default_attributes(
 )
@@ -43,6 +44,7 @@ override_attributes(
       'owner' => Grid::DOMAIN
     },
     'static' => {
+=begin
       ## static multi-cast
       'udp_send_channels' => [
         {
@@ -59,7 +61,7 @@ override_attributes(
           'bind' => mcast_addr
         }
       ]
-=begin
+=end
       ## static uni-cast
       'udp_send_channels' => udp_send_channels4ucast,
       'udp_recv_channels' => [
@@ -69,7 +71,6 @@ override_attributes(
           'bind' => ''
         }
       ]
-=end
     }
   }
 )
index 124ba95..281774b 100644 (file)
@@ -2,22 +2,24 @@ $LOAD_PATH.push("#{File.dirname(__FILE__)}/../_lib")
 #${chef-repo}/_lib/grid.rb
 require 'grid'
 
-name 'ptolemy-nn'
-description 'Ptolemy NameNode node'
+cluster_name = 'ptolemy'
+cluster_sym = cluster_name.to_sym
+
+name "#{cluster_name}-nn"
+description "#{cluster_name.capitalize} NameNode node"
 
 run_list(
   'role[node_commons]',
   #'role[grid-realm]',
   'role[ganglia-gmond]',
-  'role[ptolemy-node]'
+  "role[#{cluster_name}-node]"
 )
 
 #env_run_lists()
 
-this_subcluster = Grid::CLUSTERS[:ptolemy][:namenodes]
+this_subcluster = Grid::CLUSTERS[cluster_sym][:namenodes]
 mcast_addr = this_subcluster[:mcast_addr]
 port = '8649'
-=begin
 # uni-cast
 udp_send_channels4ucast = []
 this_subcluster[:nodes].first(2).each {|host|
@@ -30,7 +32,6 @@ this_subcluster[:nodes].first(2).each {|host|
     }
   )
 }
-=end
 
 default_attributes(
 )
@@ -43,6 +44,7 @@ override_attributes(
       'owner' => Grid::DOMAIN
     },
     'static' => {
+=begin
       ## static multi-cast
       'udp_send_channels' => [
         {
@@ -59,7 +61,7 @@ override_attributes(
           'bind' => mcast_addr
         }
       ]
-=begin
+=end
       ## static uni-cast
       'udp_send_channels' => udp_send_channels4ucast,
       'udp_recv_channels' => [
@@ -69,7 +71,6 @@ override_attributes(
           'bind' => ''
         }
       ]
-=end
     }
   }
 )
index a8672b4..de85f1a 100644 (file)
@@ -2,22 +2,27 @@ $LOAD_PATH.push("#{File.dirname(__FILE__)}/../_lib")
 #${chef-repo}/_lib/grid.rb
 require 'grid'
 
-name 'ptolemy-node'
-description 'Ptolemy cluster node'
+cluster_name = 'ptolemy'
+cluster_sym = cluster_name.to_sym
+hadoop_version = '1.2.1'
+hbase_version = '0.94.7'
+
+name "#{cluster_name}-node"
+description "#{cluster_name.capitalize} cluster node"
 
 run_list(
-  'role[hadoop-ptolemy]',
-  #'role[hadoop-ptolemy-with-security]',
-  #'role[hbase-ptolemy-with-security]'
+  "role[hadoop-#{cluster_name}]",
+  #"role[hadoop-#{cluster_name}-with-security]",
+  #"role[hbase-#{cluster_name}-with-security]"
 )
 
 #env_run_lists()
 
-cluster = Grid::CLUSTERS[:ptolemy]
+cluster = Grid::CLUSTERS[cluster_sym]
 
 default_attributes(
   'hadoop' => {
-    'version' => '1.2.1',
+    'version' => hadoop_version,
     'metrics2' => {
       # multi-cast
       'namenode.sink.ganglia.servers'    => "#{cluster[:namenodes][:mcast_addr]}:8649",
@@ -30,7 +35,7 @@ default_attributes(
   },
 =begin
   'hbase' => {
-    'version' => '0.94.7'
+    'version' => hbase_version
   }
 =end
 )