Skip to content
idempotent redis cookbook without any dependencies
Find file
Latest commit d0536dc Apr 22, 2013 @damm - Refactor to Resource & Provider
- Add Test-kitchen suite
- Update README to the html table style

Signed-off-by: Scott M. Likens <>
Failed to load latest commit information.
providers - Refactor to Resource & Provider Apr 22, 2013
Berksfile - Refactor to Resource & Provider Apr 23, 2013


This cookbook provides the ability to install and configure redis without any implementation details beyond that.



Opscode cookbooks:

  • build-essential
  • runit - due to test-kitchen testing with runit

Resources and Providers

This cookbook provides two resources and corresponding providers.



  • tarball - installs redis using a tarball.
  • git - installs redis using git to obtain the source code.

Attribute Parameters:


Attribute Type Description Default
version String Version of Redis to install 2.6.7
tarball_location String Base URI of where to fetch the tarball
git Hash Git repository to install redis from {"uri" => "", "reference" => "2.6.7" }


Attribute Type Description Default
template_source String If you want to specify an alternate erb template to be processed, you would specify it here redis.conf.erb
cookbook String If you want to specify an alternate erb template in a different cookbook, you would specify it here redis_development
filename String Specifies the redis configuration filename /etc/redis.conf
daemonize String If you need to have redis run daemonized you would specify it here no
pidfile String When running daemonized, Redis writes a pid file if you want to specify a filename other than /var/run/redis.pidspecify it here /var/run/
port Fixnum Specifies what port redis should be configured to listen on 6379
bind String Specifies what IPaddress for redis to listen on
unixsocket String Specify the path for the unix socket that will be used to listen for incoming connections. There is no default, so Redis will not listen on a unix socket when not specified.
unixsocketperm Fixnum Specifies the permissions of the unix socket 755
timeout Fixnum Close the connection after a client is idle for N seconds 300000
loglevel String Specify the server verbosity level. notice
logfile String Specify the log file name. /var/log/redis/redis.log
syslog_enabled String To enable logging to the system logger set this to yes
syslog_ident String Specify the syslog identity
syslog_facility String Specify the syslog facility
databases Fixnum Set the number of databases 16
save Array Will save the DB if both the given number of seconds and the given number of write operations against the DB occurred. [ ["3600", "1"] ]
stop_writes_on_bgsave_error String Stop accepting writes if bgsave fails, writes will resume once bgsave completes successfully yes
rdbcompression String Compress string objects using LZF when dump .rdb databases yes
dbfilename String the filename where to dump the DB dump.rdb
dir String Specifies the working directory for redis-server /var/lib/redis
slaveof Hash Use slaveof to make a Redis instance a copy of another Redis server.
masterauth String Specifies the master is password protected (using the "requirepass" attribute)
slave_server_stale_data String If the slave has lost the connection to the master, should we still serve data even if it's possibly stale? yes
slave_read_only String Disable writes to a redis instance that is a slave yes
repl Hash Exposes repl- based configuration parameters {"ping_slave_period" => 10, "timeout" => 60}
slave_priority Fixnum The slave priority is an integer number published by Redis in the INFO output. It is used by Redis Sentinel in order to select a slave to promote into a master if the master is no longer working correctly. 100
requirepass String Require clients to issue AUTH PASSWORD> before processing any other commands. This might be useful in environments in which you do not trust others with access to the host running redis-server.
rename_command Hash It is possible to change the name of dangerous commands in a shared environment. For instance the CONFIG command may be renamed into something hard to guess so that it will still be available for internal-use tools but not available for general clients.
maxclients Fixnum Set the max number of connected clients at the same time. By default this limit is set to 10000 clients, however if the Redis server is not able to configure the process file limit to allow for the specified limit the max number of allowed clients is set to the current file limit minus 32 (as Redis reserves a few file descriptors for internal uses).
maxmemory Fixnum Don't use more memory than the specified amount of bytes. When the memory limit is reached Redis will try to remove keys accordingly to the eviction policy selected (see maxmemmory-policy).
maxmemory_policy String how Redis will select what to remove when maxmemory is reached.
maxmemory_samples Fixnum LRU and minimal TTL algorithms are not precise algorithms but approximated algorithms (in order to save memory), so you can select as well the sample size to check.
appendonly String The Append Only File is an alternative persistence mode that provides much better durability. For instance using the default data fsync policy (see later in the config file) Redis can lose just one second of writes in a dramatic event like a server power outage, or a single write if something wrong with the Redis process itself happens, but the operating system is still running correctly. no
appendfilename String The name of the append only file appendonly.aof
appendfsync String The fsync() call tells the Operating System to actually write data on disk instead to wait for more data in the output buffer. eversec
no_appendfsync_on_rewrite String When the AOF fsync policy is set to always or everysec, and a background saving process (a background save or AOF log background rewriting) is performing a lot of I/O against the disk, in some Linux configurations Redis may block too long on the fsync() call. Note that there is no fix for this currently, as even performing fsync in a different thread will block our synchronous write(2) call. no
autoaof Hash Automatic rewrite of the append only file. Redis is able to automatically rewrite the log file implicitly calling BGREWRITEAOF when the AOF log size grows by the specified percentage. {"rewritepercentage" => 100, "rewriteminsize" => "64mb"}
luatimelimit Fixnum Max execution time of a Lua script in milliseconds. 5000
slowlog Hash The Redis Slow Log is a system to log queries that exceeded a specified execution time. The execution time does not include the I/O operations like talking with the client, sending the reply and so forth, but just the time needed to actually execute the command (this is the only stage of command execution where the thread is blocked and can not serve other requests in the meantime). {"slowerthan" => 10000, "max-len" => 128}
hash_max_ziplist Hash Hashes are encoded using a memory efficient data structure when they have a small number of entries, and the biggest entry does not exceed a given threshold. {"entries" => 512, "value" => 64}
list_max_ziplist Hash Similarly to hashes, small lists are also encoded in a special way in order to save a lot of space. {"entries" => 512, "value" => 64}
set_max_intset Fixnum Sets have a special encoding in just one case: when a set is composed of just strings that happens to be integers in radix 10 in the range of 64 bit signed integers. 512
zset_max_ziplist Hash Similarly to hashes and lists, sorted sets are also specially encoded in order to save a lot of space {"entries" => 128, "value" => 64}
activerehashing String Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in order to help rehashing the main Redis hash table (the one mapping top-level keys to values). The hash table implementation Redis uses (see dict.c) performs a lazy rehashing: the more operation you run into an hash table that is rehashing, the more rehashing "steps" are performed, so if the server is idle the rehashing is never complete and some more memory is used by the hash table. yes
client_output_buffer_limit Hash The client output buffer limits can be used to force disconnection of clients that are not reading data from the server fast enough for some reason (a common reason is that a Pub/Sub client can't consume messages as fast as the publisher can produce them). {"normal" => [0,0,0], "slave" => ["256mb","64mb",60], "pubsub" => ["32mb", "8mb", 60] }
include Array Include one or more other config files here. This is useful if you have a standard template that goes to all Redis server but also need to customize a few per-server settings. Include files can include other files, so use this wisely.




  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write you change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License and Author

Author:: Scott M. Likens ( Copyright:: 2013, Scott M. Likens

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Something went wrong with that request. Please try again.