Forge Home

redis

Redis installation and configuration module

10,863 downloads

10,162 latest version

3.6 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 0.0.5 (latest)
  • 0.0.4
  • 0.0.2
  • 0.0.1
released Apr 9th 2014

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'gsick-redis', '0.0.5'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add gsick-redis
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install gsick-redis --version 0.0.5

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

gsick/redis — version 0.0.5 Apr 9th 2014

Build Status Coverage Status (95% with rspec-puppet)

puppet-redis

Redis/Redis sentinel multiple instances installation and configuration module. Redis

Table of Contents

Status

0.0.5 released.

Dependencies

This module requires Puppet >= 3.4.0 due to each function, need parser = future in puppet.conf.

Usage

In your puppet file

node default {
  include redis
}

Default configuration

Redis

In your hieradata file

---
redis::version: 2.8.8

It will create /etc/redis/6379.conf see file. The default template configuration comes from redis.conf provided by the original package. Only these default values are uncommented/added/changed:

daemonize yes
pidfile /var/run/redis_6379.pid
port 6379
logfile /var/log/redis_6379.log
dir /var/lib/redis/6379

Read Available redis properties for some properties hiera syntax

Redis sentinel

In your hieradata file

---
redis::version: 2.8.8
redis::servers:
    redis_26389:
        sentinel: true
        conf:
          sentinel monitor: mymaster 127.0.0.1 6379 2
          sentinel down-after-milliseconds: mymaster 30000
          sentinel parallel-syncs: mymaster 1
          sentinel failover-timeout: mymaster 180000

It will create /etc/redis/26389.conf see file. The default template configuration comes from sentinel.conf provided by the original package. Only these default values are uncommented/added/changed:

daemonize yes
pidfile /var/run/redis_26389.pid
port 26389
logfile /var/log/redis_26389.log
dir /var/lib/redis/26389
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds: mymaster 30000
sentinel parallel-syncs: mymaster 1
sentinel failover-timeout: mymaster 180000

Read Available redis properties for sentinel properties hiera syntax

Advanced configuration

Parameters

  • redis::version: version of Redis (required)
  • redis::servers: hash of servers instances, default { redis_6379 => {} }
    • sentinel: boolean, redis sentinel, default false
    • default_template: boolean, use default redis template, default true
    • conf: hash of redis properties, default { daemonize => 'yes' }
  • redis::conf_dir: configuration directory, default /etc/redis
  • redis::data_dir: data directory, default /var/lib/redis
  • redis::sysctl: boolean, apply sysctl overcommit conf, default true
  • redis::tmp: tmp directory used by install, default /tmp

Available redis properties

All properties can be added. But due to the regex used, there are some restrictions:

Don't forget double-quotes "" for "yes" and "no" otherwise puppet will understand true or false.

Some properties only work with default_template = true:

  • rename-command
  • appendfsync

The key of some others must have two parts:

  • client-output-buffer-limit

    • client-output-buffer-limit normal: 64mb 0 0
    • client-output-buffer-limit slave: 128mb 64mb 60
    • client-output-buffer-limit pubsub: 64mb 8mb 60
  • save

    • save 900: 1
    • save 300: 10
    • save 60: 10000
  • sentinel

    • sentinel monitor: mymaster 127.0.0.1 6379 2
    • sentinel auth-pass: mymaster MySUPER--secret-0123passw0rd
    • sentinel down-after-milliseconds: mymaster 30000
    • sentinel parallel-syncs: mymaster 2
    • sentinel failover-timeout: mymaster 190000
    • sentinel notification-script: mymaster /var/redis/notify.sh
    • sentinel client-reconfig-script: mymaster /var/redis/reconfig.sh

No template

---
redis::version: 2.8.8
redis::servers:
    my_redis_1:
      default_template: false
      conf:
        port: 9999
        property_key: property_value
        ...

It will create /etc/redis/9999.conf with these default values:

port 9999
logfile /var/log/redis_9999.log
dir /var/lib/redis/9999
pidfile /var/run/redis_9999.pid
daemonize yes
property_key property_value
...

Add/Uncomment properties

---
redis::version: 2.8.8
redis::servers:
    redis_7979:
        conf:
          port: 7979
          bind: 127.0.0.1
          loglevel: debug
          appendonly: "no"
          ...

Comment properties

---
redis::version: 2.8.8
redis::servers:
    my_redis_1:
      default_template: false
      conf:
        port: 9999
        "#slave-read-only": "yes"
        "#min-slaves-to-write": 3
        "#property_key": property_value
        ...

will give:

...
# slave-read-only yes
# min-slaves-to-write 3
# property_key property_value
...

Multiple Redis instances

---
redis::version: 2.8.8
redis::servers:
    my_redis_1:
      conf:
        port: 9999
        property_key: property_value
        ...
    my_redis_3:
      conf:
        port: 8888
        property_key: property_value
        ...
    my_redis_2:
      sentinel: true
      conf:
        port: 29999
        property_key: property_value
        ...

Service

$ service redis_${port} start/stop/restart

Examples

Redis LRU cache

---
redis::version: 2.8.8
redis::servers:
    redis_LRU_cache:
        conf:
          bind: 127.0.0.1
          "#save 900": 1
          "#save 300": 10
          "#save 60": 10000
          maxmemory: 100mb
          maxmemory-policy: volatile-lru
          maxmemory-samples: 5

Redis sentinel

---
redis::version: 2.8.8
redis::servers:
    redis_sentinel:
        sentinel: true
        conf:
          sentinel monitor: thor 192.168.0.12 6379 2
          sentinel down-after-milliseconds: thor 30000
          sentinel parallel-syncs: thor 1
          sentinel failover-timeout: thor 180000

Redis + Redis sentinel + LRU cache

---
redis::version: 2.8.8
redis::servers:
    redis_master:
        conf:
          port: 6379
    redis_sentinel:
        sentinel: true
        conf:
          sentinel monitor: thor 127.0.0.1 6379 2
          sentinel down-after-milliseconds: thor 30000
          sentinel parallel-syncs: thor 1
          sentinel failover-timeout: thor 180000
    redis_LRU_cache:
        conf:
          port: 7979
          bind: 127.0.0.1
          "#save 900": 1
          "#save 300": 10
          "#save 60": 10000
          maxmemory: 100mb
          maxmemory-policy: volatile-lru
          maxmemory-samples: 5

Installation

puppet

$ puppet module install gsick-redis

librarian-puppet

Add in your Puppetfile

mod 'gsick/redis'

and run

$ librarian-puppet update

Tests

Unit tests

fix_future_test.sh will be remove after the next release of puppet-lint and rspec-puppet.

$ ./fix_future_test.sh
$ bundle install
$ rake test

Smoke tests

$ puppet apply tests/init.pp --noop

Authors

Gamaliel Sick

Contributing

  • Fork it
  • Create your feature branch git checkout -b my-new-feature
  • Commit your changes git commit -am 'Add some feature'
  • Push to the branch git push origin my-new-feature
  • Create new Pull Request

Licence

The MIT License (MIT)

Copyright (c) 2014 gsick

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.