OSDN Git Service

add roles for the ptolemy cluster.
authorwhitestar <whitestar@gaea.test>
Wed, 25 Dec 2013 11:28:13 +0000 (20:28 +0900)
committerwhitestar <whitestar@gaea.test>
Wed, 25 Dec 2013 11:28:13 +0000 (20:28 +0900)
13 files changed:
_lib/grid.rb
nodes/dn40.grid.example.com.json [new file with mode: 0644]
nodes/gm40.grid.example.com.json [new file with mode: 0644]
nodes/jt40.grid.example.com.json [new file with mode: 0644]
nodes/nn40.grid.example.com.json [new file with mode: 0644]
roles/hadoop-pleiades.rb
roles/hadoop-ptolemy.rb [new file with mode: 0644]
roles/pleiades-gm.rb
roles/ptolemy-dn.rb [new file with mode: 0644]
roles/ptolemy-gm.rb [new file with mode: 0644]
roles/ptolemy-jt.rb [new file with mode: 0644]
roles/ptolemy-nn.rb [new file with mode: 0644]
roles/ptolemy-node.rb [new file with mode: 0644]

index 08b047b..a75f686 100644 (file)
@@ -177,6 +177,69 @@ module Grid
         :nodes => 'dn0000{0..1}'.expand,
         :mcast_addr => '239.2.11.20'
       }
+    },
+    :praesepe => {
+    },
+    :hyades => {
+    },
+    :ptolemy => {
+      :gmetads => {
+        :name => 'gmetads',
+        :alias => 'Ganglia',
+        :use_host_object => 'generic-gmetad-host',
+        :service_hostname => 'gm40',
+        #:service_hostname => 'ptolemy-gm',
+        :nodes => 'gm40'.expand,
+        #:nodes => 'gm4{0..1}'.expand,
+        :mcast_addr => '239.2.14.3'
+      },
+      :namenodes => {
+        :name => 'namenodes',
+        :alias => 'NameNodes',
+        :use_host_object => 'generic-namenode-host',
+        :service_hostname => 'ptolemy-nn',
+        :nodes => 'nn40'.expand,
+        #:nodes => 'nn0{0..2}'.expand,
+        :mcast_addr => '239.2.14.8'
+      },
+=begin
+      :resourcemanagers => {
+        :name => 'resourcemanagers',
+        :alias => 'ResourceManagers',
+        :use_host_object => 'generic-resourcemanager-host',
+        :service_hostname => 'ptolemy-rm',
+        :nodes => 'rm40'.expand,
+        #:nodes => 'rm4{0..1}'.expand,
+        :mcast_addr => '239.2.14.9'
+      },
+=end
+      :jobtrackers => {
+        :name => 'jobtrackers',
+        :alias => 'JobTrackers',
+        :use_host_object => 'generic-jobtracker-host',
+        :service_hostname => 'ptolemy-jt',
+        :nodes =>  'jt40'.expand,
+        #:nodes =>  'jt4{0..1}'.expand,
+        :mcast_addr => '239.2.14.9'
+      },
+=begin
+      :historyservers => {
+        :name => 'historyservers',
+        :alias => 'HistoryServers',
+        :use_host_object => 'generic-historyserver-host',
+        :service_hostname => 'ptolemy-jh',
+        :nodes => 'jh4{0..1}'.expand,
+        :mcast_addr => '239.2.14.9'
+      },
+=end
+      :datanodes => {
+        :name => 'datanodes',
+        :alias => 'DataNodes',
+        :use_host_object => 'generic-datanode-host',
+        :service_hostname => nil,
+        :nodes => 'dn4000{0..1}'.expand,
+        :mcast_addr => '239.2.14.20'
+      }
     }
   }
 end
diff --git a/nodes/dn40.grid.example.com.json b/nodes/dn40.grid.example.com.json
new file mode 100644 (file)
index 0000000..b167b33
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "run_list": [
+    "role[ptolemy-dn]"
+  ]
+}
diff --git a/nodes/gm40.grid.example.com.json b/nodes/gm40.grid.example.com.json
new file mode 100644 (file)
index 0000000..8c5ef91
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "run_list": [
+    "role[ptolemy-gm]"
+  ]
+}
diff --git a/nodes/jt40.grid.example.com.json b/nodes/jt40.grid.example.com.json
new file mode 100644 (file)
index 0000000..cf509ac
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "run_list": [
+    "role[ptolemy-jt]"
+  ]
+}
diff --git a/nodes/nn40.grid.example.com.json b/nodes/nn40.grid.example.com.json
new file mode 100644 (file)
index 0000000..fd7c10b
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "run_list": [
+    "role[ptolemy-nn]"
+  ]
+}
index 6d8a983..37b0421 100644 (file)
@@ -8,7 +8,7 @@ run_list(
   'role[hadoop]'
 )
 
-#env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"], "_default" => []
+#env_run_lists()
 
 grid_vol_root = '/grid/vol'
 hadoop_attributes = {
@@ -38,4 +38,5 @@ default_attributes(
   'hadoop' => hadoop_attributes
 )
 
-#override_attributes "apache2" => { "max_children" => "50" }
+#override_attributes()
+
diff --git a/roles/hadoop-ptolemy.rb b/roles/hadoop-ptolemy.rb
new file mode 100644 (file)
index 0000000..60b1d5b
--- /dev/null
@@ -0,0 +1,42 @@
+name 'hadoop-ptolemy'
+description 'Pleiades Hadoop cluster node'
+
+run_list(
+  'role[node_commons]',
+  # LDAP (option)
+  #'role[nameservice-client-grid]',
+  'role[hadoop]'
+)
+
+#env_run_lists()
+
+grid_vol_root = '/grid/vol'
+hadoop_attributes = {
+  # core-site.xml
+  'this.cluster.name' => 'ptolemy', 
+  'this.domain' => 'grid.example.com',
+  '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",
+  # hdfs-site.xml
+  'this.secondary.namenode.fqdn' => '${this.cluster.name}-cn.${this.domain}',
+  'dfs.name.dir' => "#{grid_vol_root}/0/var/lib/${user.name}/name",
+  #'dfs.name.dir' => "#{grid_vol_root}/0/var/lib/${user.name}/name,/export/home/${user.name}/var/lib/name",
+  'dfs.replication' => '2',
+  #'dfs.replication' => '3',
+  # mapred-site.xml
+  '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}',
+}
+
+default_attributes(
+  'grid' => {
+    'vol_root' => grid_vol_root,
+    'max_vol_nums' => '4'
+  },
+  'hadoop' => hadoop_attributes
+)
+
+#override_attributes()
+
index c3f2c78..07708bc 100644 (file)
@@ -15,7 +15,7 @@ run_list(
   'role[ganglia-web]'
 )
 
-#env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"], "_default" => []
+#env_run_lists()
 
 this_subcluster = Grid::CLUSTERS[:pleiades][:gmetads]
 mcast_addr = this_subcluster[:mcast_addr]
diff --git a/roles/ptolemy-dn.rb b/roles/ptolemy-dn.rb
new file mode 100644 (file)
index 0000000..30fb1f1
--- /dev/null
@@ -0,0 +1,69 @@
+$LOAD_PATH.push("#{File.dirname(__FILE__)}/../_lib")
+#${chef-repo}/_lib/grid.rb
+require 'grid'
+
+name 'ptolemy-dn'
+description 'Ptolemy DataNode node'
+
+run_list(
+  'role[node_commons]',
+  #'role[grid-realm]',
+  'role[ganglia-gmond]',
+  'role[ptolemy-node]'
+)
+
+#env_run_lists()
+
+mcast_addr = Grid::CLUSTERS[:ptolemy][:datanodes][:mcast_addr]
+port = '8649'
+
+default_attributes(
+)
+
+override_attributes(
+  'ganglia' => {
+    # gmond
+    'cluster' => {
+      'name' => 'DataNode00000',
+      'owner' => Grid::DOMAIN
+    },
+    ## static multi-cast
+    'static' => {
+      'udp_send_channels' => [
+        {
+          'mcast_join' => mcast_addr,
+          'host' => '',
+          'port' => port,
+          'ttl' => '1'
+        }
+      ],
+      'udp_recv_channels' => [
+        {
+          'mcast_join' => mcast_addr,
+          'port' => port,
+          'bind' => mcast_addr
+        }
+      ]
+    }
+=begin
+    ## automatic multi/uni-cast
+    'gmond_conf_type' => 'automatic',
+    'automatic' = {
+      'cluster_name_prefix' => 'DataNode', # DataNode#####
+      'cast_mode' => 'uni',                # or multi
+      '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
+      '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
+    }
+=end
+  }
+)
diff --git a/roles/ptolemy-gm.rb b/roles/ptolemy-gm.rb
new file mode 100644 (file)
index 0000000..8b50b46
--- /dev/null
@@ -0,0 +1,130 @@
+$LOAD_PATH.push("#{File.dirname(__FILE__)}/../_lib")
+#${chef-repo}/_lib/grid.rb
+require 'grid'
+require 'rubygems'
+require 'bracecomp'
+
+name 'ptolemy-gm'
+description 'Ptolemy ganglia gmetad node'
+
+run_list(
+  'role[node_commons]',
+  #'role[nameservice-client-grid]',
+  'role[ganglia-gmond]',
+  'role[ganglia-gmetad]',
+  'role[ganglia-web]'
+)
+
+#env_run_lists()
+
+this_subcluster = Grid::CLUSTERS[:ptolemy][: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|
+  udp_send_channels4ucast.push(
+    {
+      'mcast_join' => '',
+      'host' => "#{host}.#{Grid::DOMAIN}",
+      'port' => port,
+      'ttl' => ''
+    }
+  )
+}
+=end
+
+# for non-DataNodes
+data_sources = []
+Grid::CLUSTERS[:ptolemy].select{|key| key != :datanodes}.each {|key, cluster|
+  data_sources.push(
+    {
+      :name => cluster[:alias],
+      :polling_interval => polling_interval,
+      # head nodes: 2
+      :address_list => cluster[:nodes].first(2).map{|host| "#{host}.#{Grid::DOMAIN}"}
+    }
+  )
+}
+
+# for DataNodes
+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}}.#{Grid::DOMAIN}".expand
+    }
+  )
+}
+
+default_attributes(
+  'ganglia' => {
+    'web' => {
+=begin
+      'Allow' => [
+        "from .#{Grid::DOMAIN}",
+        'from 192.168.0.0/16'],
+      'AuthType' => 'Kerberos',
+      'mod_auth_kerb' => {
+        'KrbAuthRealms' => Grid::REALM,
+        'Krb5Keytab' => '/etc/krb5.keytab'
+      }
+=end
+    }
+  },
+)
+
+override_attributes(
+  'ganglia' => {
+    # gmond
+    'cluster' => {
+      'name' => this_subcluster[:alias],
+      'owner' => Grid::DOMAIN
+    },
+    ## static multi-cast
+    'static' => {
+      'udp_send_channels' => [
+        {
+          'mcast_join' => mcast_addr,
+          'host' => '',
+          'port' => port,
+          'ttl' => '1'
+        }
+      ],
+      'udp_recv_channels' => [
+        {
+          'mcast_join' => mcast_addr,
+          'port' => port,
+          'bind' => mcast_addr
+        }
+      ],
+=begin
+      ## static uni-cast
+      'udp_send_channels' => udp_send_channels4ucast,
+      'udp_recv_channels' => [
+        {
+          'mcast_join' => '',
+          'port' => port,
+          '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}"},
+    'data_sources' => data_sources + dn_data_sources
+  }
+)
diff --git a/roles/ptolemy-jt.rb b/roles/ptolemy-jt.rb
new file mode 100644 (file)
index 0000000..8c452cc
--- /dev/null
@@ -0,0 +1,75 @@
+$LOAD_PATH.push("#{File.dirname(__FILE__)}/../_lib")
+#${chef-repo}/_lib/grid.rb
+require 'grid'
+
+name 'ptolemy-jt'
+description 'Ptolemy JobTracker node'
+
+run_list(
+  'role[node_commons]',
+  #'role[grid-realm]',
+  'role[ganglia-gmond]',
+  'role[ptolemy-node]'
+)
+
+#env_run_lists()
+
+this_subcluster = Grid::CLUSTERS[:ptolemy][:jobtrackers]
+mcast_addr = this_subcluster[:mcast_addr]
+port = '8649'
+=begin
+# uni-cast
+udp_send_channels4ucast = []
+this_subcluster[:nodes].first(2).each {|host|
+  udp_send_channels4ucast.push(
+    {
+      'mcast_join' => '',
+      'host' => "#{host}.#{Grid::DOMAIN}",
+      'port' => port,
+      'ttl' => ''
+    }
+  )
+}
+=end
+
+default_attributes(
+)
+
+override_attributes(
+  'ganglia' => {
+    # gmond
+    'cluster' => {
+      'name' => this_subcluster[:alias],
+      'owner' => Grid::DOMAIN
+    },
+    'static' => {
+      ## static multi-cast
+      'udp_send_channels' => [
+        {
+          'mcast_join' => mcast_addr,
+          'host' => '',
+          'port' => port,
+          'ttl' => '1'
+        }
+      ],
+      'udp_recv_channels' => [
+        {
+          'mcast_join' => mcast_addr,
+          'port' => port,
+          'bind' => mcast_addr
+        }
+      ]
+=begin
+      ## static uni-cast
+      'udp_send_channels' => udp_send_channels4ucast,
+      'udp_recv_channels' => [
+        {
+          'mcast_join' => '',
+          'port' => port,
+          'bind' => ''
+        }
+      ]
+=end
+    }
+  }
+)
diff --git a/roles/ptolemy-nn.rb b/roles/ptolemy-nn.rb
new file mode 100644 (file)
index 0000000..124ba95
--- /dev/null
@@ -0,0 +1,75 @@
+$LOAD_PATH.push("#{File.dirname(__FILE__)}/../_lib")
+#${chef-repo}/_lib/grid.rb
+require 'grid'
+
+name 'ptolemy-nn'
+description 'Ptolemy NameNode node'
+
+run_list(
+  'role[node_commons]',
+  #'role[grid-realm]',
+  'role[ganglia-gmond]',
+  'role[ptolemy-node]'
+)
+
+#env_run_lists()
+
+this_subcluster = Grid::CLUSTERS[:ptolemy][:namenodes]
+mcast_addr = this_subcluster[:mcast_addr]
+port = '8649'
+=begin
+# uni-cast
+udp_send_channels4ucast = []
+this_subcluster[:nodes].first(2).each {|host|
+  udp_send_channels4ucast.push(
+    {
+      'mcast_join' => '',
+      'host' => "#{host}.#{Grid::DOMAIN}",
+      'port' => port,
+      'ttl' => ''
+    }
+  )
+}
+=end
+
+default_attributes(
+)
+
+override_attributes(
+  'ganglia' => {
+    # gmond
+    'cluster' => {
+      'name' => this_subcluster[:alias],
+      'owner' => Grid::DOMAIN
+    },
+    'static' => {
+      ## static multi-cast
+      'udp_send_channels' => [
+        {
+          'mcast_join' => mcast_addr,
+          'host' => '',
+          'port' => port,
+          'ttl' => '1'
+        }
+      ],
+      'udp_recv_channels' => [
+        {
+          'mcast_join' => mcast_addr,
+          'port' => port,
+          'bind' => mcast_addr
+        }
+      ]
+=begin
+      ## static uni-cast
+      'udp_send_channels' => udp_send_channels4ucast,
+      'udp_recv_channels' => [
+        {
+          'mcast_join' => '',
+          'port' => port,
+          'bind' => ''
+        }
+      ]
+=end
+    }
+  }
+)
diff --git a/roles/ptolemy-node.rb b/roles/ptolemy-node.rb
new file mode 100644 (file)
index 0000000..a8672b4
--- /dev/null
@@ -0,0 +1,39 @@
+$LOAD_PATH.push("#{File.dirname(__FILE__)}/../_lib")
+#${chef-repo}/_lib/grid.rb
+require 'grid'
+
+name 'ptolemy-node'
+description 'Ptolemy cluster node'
+
+run_list(
+  'role[hadoop-ptolemy]',
+  #'role[hadoop-ptolemy-with-security]',
+  #'role[hbase-ptolemy-with-security]'
+)
+
+#env_run_lists()
+
+cluster = Grid::CLUSTERS[:ptolemy]
+
+default_attributes(
+  'hadoop' => {
+    'version' => '1.2.1',
+    'metrics2' => {
+      # multi-cast
+      'namenode.sink.ganglia.servers'    => "#{cluster[:namenodes][:mcast_addr]}:8649",
+      'datanode.sink.ganglia.servers'    => "#{cluster[:datanodes][:mcast_addr]}:8649",
+      'jobtracker.sink.ganglia.servers'  => "#{cluster[:jobtrackers][:mcast_addr]}:8649",
+      'tasktracker.sink.ganglia.servers' => "#{cluster[:datanodes][:mcast_addr]}:8649",
+      'maptask.sink.ganglia.servers'     => "#{cluster[:datanodes][:mcast_addr]}:8649",
+      'reducetask.sink.ganglia.servers'  => "#{cluster[:datanodes][:mcast_addr]}:8649"
+    }
+  },
+=begin
+  'hbase' => {
+    'version' => '0.94.7'
+  }
+=end
+)
+
+#override_attributes()
+