aboutsummaryrefslogtreecommitdiff
path: root/bigtop-deploy/puppet/modules/hadoop_hbase/manifests/init.pp
blob: fb1de9682b024c8b69239287918e3c2016917171 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# 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_hbase {

  class deploy ($roles, $auxiliary = true) {
    if ("hbase-server" in $roles) {
      include hadoop_hbase::server
    }

    if ("hbase-master" in $roles) {
      if ($auxiliary == true) {
        include hadoop_zookeeper::server
      }

      include hadoop::common_hdfs
      include hadoop::init_hdfs
      include hadoop_hbase::master
      Class['Hadoop::Init_hdfs'] -> Class['Hadoop_hbase::Master']
    }

    if ("hbase-client" in $roles) {
      include hadoop_hbase::client
    }
  }

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

  class common_config ($rootdir, $zookeeper_quorum, $kerberos_realm = "", $heap_size="1024") {
    include hadoop_hbase::client_package
    if ($kerberos_realm) {
      require kerberos::client
      kerberos::host_keytab { "hbase": 
        spnego => true,
        require => Package["hbase"],
      }

      file { "/etc/hbase/conf/jaas.conf":
        content => template("hadoop_hbase/jaas.conf"),
        require => Package["hbase"],
      }
    }

    file { "/etc/hbase/conf/hbase-site.xml":
      content => template("hadoop_hbase/hbase-site.xml"),
      require => Package["hbase"],
    }
    file { "/etc/hbase/conf/hbase-env.sh":
      content => template("hadoop_hbase/hbase-env.sh"),
      require => Package["hbase"],
    }
  }

  class client($thrift = false) {
    include hadoop_hbase::common_config

    if ($thrift) {
      package { "hbase-thrift":
        ensure => latest,
      }

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

  class server {
    include hadoop_hbase::common_config

    package { "hbase-regionserver":
      ensure => latest,
    }

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

  class master {
    include hadoop_hbase::common_config

    package { "hbase-master":
      ensure => latest,
    }

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