Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Latest commit

 

History

History
93 lines (77 loc) · 4.13 KB

README.md

File metadata and controls

93 lines (77 loc) · 4.13 KB

Redis Cookbook

Build Status Code Quality Test Coverage License

Application cookbook which installs and configures the Redis key-value database and Redis Sentinel which provides high-availability for the database.

Note

This cookbook is no longer being actively maintained. Use the redisio cookbook instead:

https://supermarket.chef.io/cookbooks/redisio

Platforms

The following platforms are tested using Test Kitchen:

  • Ubuntu 12.04/14.04/16.04
  • CentOS (RHEL) 5/6/7

Basic Usage

The default recipe installs and configures the Redis database. The install resource will use the package install provider for the node's operating system. The configuration of the database is managed through the config resource which can be tuned with node attributes.

Additionally, there is a sentinel recipe which installs and configures Redis Sentinel. It installs Sentinel using the same installation provider mechanism as the default resource.

Advanced Usage

The installation resource attributes are able to be tuned easily; for deployments we suggest using Chef Policyfiles. An example policyfile is used for configuring Test Kitchen.

Let's consider a common need for enterprise networks to mirror files internally because they are unable to go out to the Internet. Using the archive provider the Redis database will be built from source.

name 'redis'
default_source :community
run_list 'blp-redis::default'

default['blp-redis']['provider'] = 'archive'
default['blp-redis']['options']['version'] = '3.2.3'
default['blp-redis']['options']['artifact_url'] = 'http://mirror.corporate.com/redis/redis-%{version}.tar.gz'

In addition, you may find it useful to use the following Policyfile.rb for production deployment purposes. This follows a post about how to tune Redis and implements these settings using different (external) cookbooks. This policy can be deployed to the Chef Server using the chef push production command.

name 'redis'
default_source :community
run_list 'ulimit::default', 'sysctl::params', 'blp-redis::default'

# @see http://shokunin.co/blog/2014/11/11/operational_redis.html
# @see https://github.com/ziyasal/redisetup#system-side-settings
override['blp-redis']['config']['tcp_backlog'] = 65_535
override['blp-redis']['config']['maxclients'] = 10_000
override['ulimit']['users']['redis']['filehandle_limit'] = 65_535
override['sysctl']['params']['vm.overcommit_memory'] = 1
override['sysctl']['params']['vm.swappiness'] = 0
override['sysctl']['params']['net.ipv4.tcp_sack'] = 1
override['sysctl']['params']['net.ipv4.tcp_timestamps'] = 1
override['sysctl']['params']['net.ipv4.tcp_window_scaling'] = 1
override['sysctl']['params']['net.ipv4.tcp_congestion_control'] = 'cubic'
override['sysctl']['params']['net.ipv4.tcp_syncookies'] = 1
override['sysctl']['params']['net.ipv4.tcp_tw_recycle'] = 1
override['sysctl']['params']['net.ipv4.tcp_max_syn_backlog'] = 65_535
override['sysctl']['params']['net.core.somaxconn'] = 65_535
override['sysctl']['params']['net.core.rmem_max'] = 65_535
override['sysctl']['params']['net.core.wmem_max'] = 65_535
override['sysctl']['params']['fs.file-max'] = 65_535