Puppet Class: hadoop::nfs::service

Defined in:
manifests/nfs/service.pp

Overview

Class hadoop::nfs::service

Start HDFS NFS Gateway service. Mount it locally, when the hadoop::nfs_mount parameter is non-empty.

Namenode should be launched first if it is colocated with nfs (just cosmetics, some initial exceptions in logs)

Dependencies works automatically, when collocated with HDFS namenode class. When not collocated, hadoop::hdfs_deployed parameter could be used for two-stage installation (not required).



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
# File 'manifests/nfs/service.pp', line 10

class hadoop::nfs::service {
  # NFS server gateway requires working HDFS
  if $hadoop::hdfs_deployed {
    service { $hadoop::daemons['nfs']:
      ensure    => running,
      enable    => true,
      subscribe => [File["${hadoop::confdir}/core-site.xml"], File["${hadoop::confdir}/hdfs-site.xml"]],
    }

    if $hadoop::daemons['portmap'] {
      service { $hadoop::daemons['portmap']:
        ensure => running,
        enable => true,
        before => Service[$hadoop::daemons['nfs']],
      }
    }

    # namenode should be launched first if it is colocated with nfs
    # (just cosmetics, some initial exceptions in logs)
    if $hadoop::daemon_namenode {
      include ::hadoop::namenode::service
      Class['hadoop::namenode::service'] -> Class['hadoop::nfs::service']
    }

    Service[$hadoop::daemons['nfs']] -> Hadoop::Nfs::Mount <| ensure == 'mounted' and nfs_hostname == $::fqdn |>

  } else {
    service { $hadoop::daemons['nfs']:
      ensure => 'stopped',
      enable => true,
    }
  }

  # always mount the NFS locally, if we have a mountpoint
  if $hadoop::nfs_mount and $hadoop::nfs_mount != '' {
    hadoop::nfs::mount { $hadoop::nfs_mount:
      ensure        => mounted,
      hdfs_deployed => $hadoop::hdfs_deployed,
    }
  }
}