Puppet Class: profile::nutcracker

Defined in:
modules/profile/manifests/nutcracker.pp

Overview

Class profile::nutcracker

Configures a generic nutcracker instance

Parameters:

  • redis_pools (Any) (defaults to: hiera('profile::nutcracker::redis_pools'))
  • memcached_pools (Any) (defaults to: hiera('profile::nutcracker::memcached_pools'))
  • monitor_port (Any) (defaults to: hiera('profile::nutcracker::monitor_port'))


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
# File 'modules/profile/manifests/nutcracker.pp', line 4

class profile::nutcracker(
    $redis_pools = hiera('profile::nutcracker::redis_pools'),
    $memcached_pools = hiera('profile::nutcracker::memcached_pools'),
    $monitor_port = hiera('profile::nutcracker::monitor_port'), # set to 0 if no port available
) {
    include ::passwords::redis

    # Default settings that should be ok for any pool
    # pools *need* to define just the listen and server_map entries
    $redis_base_settings = {
        auto_eject_hosts     => true,
        distribution         => 'ketama',
        redis                => true,
        redis_auth           => $::passwords::redis::main_password,
        hash                 => 'md5',
        server_connections   => 1,
        server_failure_limit => 3,
        server_retry_timeout => to_milliseconds('30s'),
        timeout              => 1000,
    }

    $memcached_base_settings = {
        auto_eject_hosts     => true,
        distribution         => 'ketama',
        hash                 => 'md5',
        preconnect           => true,
        server_connections   => 1,
        server_failure_limit => 3,
        server_retry_timeout => to_milliseconds('30s'),
        timeout              => 250,
    }

    # TODO: this is now a parser function, should be doable with map()
    # when we enable the future parser
    $pools = nutcracker_pools($redis_pools, $memcached_pools, $redis_base_settings, $memcached_base_settings)
    class { '::nutcracker':
        mbuf_size => '64k',
        pools     => $pools,
    }

    include ::profile::prometheus::nutcracker_exporter
    class { '::nutcracker::monitoring':
        port => $monitor_port,
    }


    ferm::rule { 'skip_nutcracker_conntrack_out':
        desc  => 'Skip outgoing connection tracking for Nutcracker',
        table => 'raw',
        chain => 'OUTPUT',
        rule  => 'proto tcp sport (6378:6382 11212) NOTRACK;',
    }

    ferm::rule { 'skip_nutcracker_conntrack_in':
        desc  => 'Skip incoming connection tracking for Nutcracker',
        table => 'raw',
        chain => 'PREROUTING',
        rule  => 'proto tcp dport (6378:6382 11212) NOTRACK;',
    }

}