aboutsummaryrefslogtreecommitdiff
path: root/bigtop-deploy/puppet/modules/hadoop_hive/manifests/init.pp
blob: 4b10a25a435c1f5f3f8412b90b18d99f46e820bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

class hadoop_hive {

  class deploy ($roles) {
    if ("hive-client" in $roles) {
      include hadoop_hive::client
    }

    if ("hive-server2" in $roles) {
      include hadoop_hive::server2

      # include hadoop::init_hdfs
      # Class['Hadoop::Init_hdfs'] -> Class['Hadoop_hive::Server2']
      # if ("mapred-app" in $roles) {
      #  Class['Hadoop::Mapred_app'] -> Class['Hadoop_hive::Server2']
      # }
    }
  }

  class client_package {
    package { "hive":
      ensure => latest,
    } 
  }

  class common_config ($hbase_master = "",
                       $hbase_zookeeper_quorum = "",
                       $kerberos_realm = "",
                       $server2_thrift_port = "10000",
                       $server2_thrift_http_port = "10001",
                       $hive_execution_engine = "mr") {
    include hadoop_hive::client_package
    if ($kerberos_realm) {
      require kerberos::client
      kerberos::host_keytab { "hive": 
        spnego => true,
        require => Package["hive"],
      }
    }

    file { "/etc/hive/conf/hive-site.xml":
      content => template('hadoop_hive/hive-site.xml'),
      require => Package["hive"],
    }
  }

  class client($hbase_master = "",
      $hbase_zookeeper_quorum = "",
      $hive_execution_engine = "mr") {

      include hadoop_hive::common_config
  }

  class server2 {
    include hadoop_hive::common_config

    package { "hive-server2":
      ensure => latest,
    }

    service { "hive-server2":
      ensure => running,
      require => Package["hive-server2"],
      subscribe => File["/etc/hive/conf/hive-site.xml"],
      hasrestart => true,
      hasstatus => true,
    } 
    Kerberos::Host_keytab <| title == "hive" |> -> Service["hive-server2"]
  }
}