Puppet Class: nutcracker

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

Overview

SPDX-License-Identifier: Apache-2.0

Class: nutcracker

nutcracker (AKA twemproxy) is a fast and lightweight proxy for memcached and redis. It was primarily built to reduce the connection count on the backend caching servers.

Parameters

mbuf_size

When set, will determine the size of nutcracker's mbufs. The default is 16384. See <github.com/twitter/twemproxy /blob/b2cd3ad/notes/recommendation.md> for a discussion of this option.

verbosity

Set logging level (default: 4, min: 0, max: 11).

pools

A hash defining a nutcracker server pool. See <github.com/twitter/twemproxy#configuration>.

Examples

class { '::nutcracker':
  pools => {
    'parser' => {
      listen       => '127.0.0.1:11211',
      distribution => 'ketama',
      hash         => 'md5',
      timeout      => 250,
      servers      => ['10.64.0.180:11211:1', '10.64.0.181:11211:1'],
    },
  },
}

Parameters:

  • pools (Hash)
  • ensure (Wmflib::Ensure) (defaults to: present)
  • mbuf_size (Optional[String]) (defaults to: undef)
  • verbosity (Integer[0,11]) (defaults to: 4)


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/nutcracker/manifests/init.pp', line 37

class nutcracker(
    Hash             $pools,
    Wmflib::Ensure   $ensure    = present,
    Optional[String] $mbuf_size = undef,
    Integer[0,11]    $verbosity = 4,
) {

    ensure_packages(['nutcracker'])

    file {
        default:
            ensure  => $ensure,
            owner   => 'root',
            group   => 'root',
            mode    => '0444',
            notify  => Service['nutcracker'],
            require => Package['nutcracker'];
        '/etc/nutcracker/nutcracker.yml':
            content      => template('nutcracker/nutcracker.yml.erb'),
            validate_cmd => '/usr/sbin/nutcracker --test-conf --conf-file %';
        '/etc/default/nutcracker':
            content => template('nutcracker/default.erb');
    }
    service { 'nutcracker':
        ensure  => stdlib::ensure($ensure, 'service'),
        require => Package['nutcracker'],
    }
}