Permalink
Browse files

update config file for Redis 2.6

  • Loading branch information...
1 parent e63e860 commit 44723fbe14d3e698fbdf8dd3bf9b8c53611c2cb4 @phlipper committed Jan 2, 2013
Showing with 136 additions and 74 deletions.
  1. +10 −0 README.md
  2. +10 −0 attributes/default.rb
  3. +116 −74 templates/default/redis.conf.erb
View
@@ -48,14 +48,18 @@ default["redis"]["snapshots"] = {
300 => 10,
60 => 10000
}
+default["redis"]["stop_writes_on_bgsave_error"] = "yes"
default["redis"]["rdbcompression"] = "yes"
+default["redis"]["rdbchecksum"] = "yes"
default["redis"]["dbfilename"] = "dump.rdb"
default["redis"]["dir"] = "/var/lib/redis"
default["redis"]["slaveof"] = ""
default["redis"]["masterauth"] = ""
default["redis"]["slave_serve_stale_data"] = "yes"
+default["redis"]["slave_read_only"] = "yes"
default["redis"]["repl_ping_slave_period"] = 10
default["redis"]["repl_timeout"] = 60
+default["redis"]["slave_priority"] = 100
default["redis"]["requirepass"] = ""
default["redis"]["rename_commands"] = []
default["redis"]["maxclients"] = 128
@@ -68,6 +72,7 @@ default["redis"]["appendfsync"] = "everysec"
default["redis"]["no_appendfsync_on_rewrite"] = "no"
default["redis"]["auto_aof_rewrite_percentage"] = 100
default["redis"]["auto_aof_rewrite_min_size"] = "64mb"
+default["redis"]["lua_time_limit"] = 5000
default["redis"]["slowlog_log_slower_than"] = 10000
default["redis"]["slowlog_max_len"] = 1024
default["redis"]["vm_enabled"] = "no"
@@ -84,6 +89,11 @@ default["redis"]["set_max_intset_entries"] = 512
default["redis"]["zset_max_ziplist_entries"] = 128
default["redis"]["zset_max_ziplist_value"] = 64
default["redis"]["activerehashing"] = "yes"
+default["redis"]["client_output_buffer_limit"] = {
+ "normal" => "0 0 0",
+ "slave" => "256mb 64mb 60",
+ "pubsub" => "32mb 8mb 60"
+}
default["redis"]["include_config_files"] = []
```
View
@@ -16,14 +16,18 @@
300 => 10,
60 => 10000
}
+default["redis"]["stop_writes_on_bgsave_error"] = "yes"
default["redis"]["rdbcompression"] = "yes"
+default["redis"]["rdbchecksum"] = "yes"
default["redis"]["dbfilename"] = "dump.rdb"
default["redis"]["dir"] = "/var/lib/redis"
default["redis"]["slaveof"] = ""
default["redis"]["masterauth"] = ""
default["redis"]["slave_serve_stale_data"] = "yes"
+default["redis"]["slave_read_only"] = "yes"
default["redis"]["repl_ping_slave_period"] = 10
default["redis"]["repl_timeout"] = 60
+default["redis"]["slave_priority"] = 100
default["redis"]["requirepass"] = ""
default["redis"]["rename_commands"] = []
default["redis"]["maxclients"] = 128
@@ -36,6 +40,7 @@
default["redis"]["no_appendfsync_on_rewrite"] = "no"
default["redis"]["auto_aof_rewrite_percentage"] = 100
default["redis"]["auto_aof_rewrite_min_size"] = "64mb"
+default["redis"]["lua_time_limit"] = 5000
default["redis"]["slowlog_log_slower_than"] = 10000
default["redis"]["slowlog_max_len"] = 1024
default["redis"]["vm_enabled"] = "no"
@@ -52,4 +57,9 @@
default["redis"]["zset_max_ziplist_entries"] = 128
default["redis"]["zset_max_ziplist_value"] = 64
default["redis"]["activerehashing"] = "yes"
+default["redis"]["client_output_buffer_limit"] = {
+ "normal" => "0 0 0",
+ "slave" => "256mb 64mb 60",
+ "pubsub" => "32mb 8mb 60"
+}
default["redis"]["include_config_files"] = []
@@ -86,17 +86,47 @@ databases <%= node["redis"]["databases"] %>
# after 60 sec if at least 10000 keys changed
#
# Note: you can disable saving at all commenting all the "save" lines.
+#
+# It is also possible to remove all the previously configured save
+# points by adding a save directive with a single empty string argument
+# like in the following example:
+#
+# save ""
<% node["redis"]["snapshots"].each do |interval, keys| %>
save <%= "#{interval} #{keys}" %>
<% end %>
+# By default Redis will stop accepting writes if RDB snapshots are enabled
+# (at least one save point) and the latest background save failed.
+# This will make the user aware (in an hard way) that data is not persisting
+# on disk properly, otherwise chances are that no one will notice and some
+# distater will happen.
+#
+# If the background saving process will start working again Redis will
+# automatically allow writes again.
+#
+# However if you have setup your proper monitoring of the Redis server
+# and persistence, you may want to disable this feature so that Redis will
+# continue to work as usually even if there are problems with disk,
+# permissions, and so forth.
+stop-writes-on-bgsave-error <%= node["redis"]["stop_writes_on_bgsave_error"] %>
+
# Compress string objects using LZF when dump .rdb databases?
# For default that's set to 'yes' as it's almost always a win.
# If you want to save some CPU in the saving child set it to 'no' but
# the dataset will likely be bigger if you have compressible values or keys.
rdbcompression <%= node["redis"]["rdbcompression"] %>
+# Since verison 5 of RDB a CRC64 checksum is placed at the end of the file.
+# This makes the format more resistant to corruption but there is a performance
+# hit to pay (around 10%) when saving and loading RDB files, so you can disable it
+# for maximum performances.
+#
+# RDB files created with checksum disabled have a checksum of zero that will
+# tell the loading code to skip the check.
+rdbchecksum <%= node["redis"]["rdbchecksum"] %>
+
# The filename where to dump the DB
dbfilename <%= node["redis"]["dbfilename"] %>
@@ -145,6 +175,22 @@ masterauth <%= node["redis"]["masterauth"] %>
#
slave-serve-stale-data <%= node["redis"]["slave_serve_stale_data"] %>
+# You can configure a slave instance to accept writes or not. Writing against
+# a slave instance may be useful to store some ephemeral data (because data
+# written on a slave will be easily deleted after resync with the master) but
+# may also cause problems if clients are writing to it because of a
+# misconfiguration.
+#
+# Since Redis 2.6 by default slaves are read-only.
+#
+# Note: read only slaves are not designed to be exposed to untrusted clients
+# on the internet. It's just a protection layer against misuse of the instance.
+# Still a read only slave exports by default all the administrative commands
+# such as CONFIG, DEBUG, and so forth. To a limited extend you can improve
+# security of read only slaves using 'rename-command' to shadow all the
+# administrative / dangerous commands.
+slave-read-only <%= node["redis"]["slave_read_only"] %>
+
# Slaves send PINGs to server in a predefined interval. It's possible to change
# this interval with the repl_ping_slave_period option. The default value is 10
# seconds.
@@ -160,6 +206,21 @@ repl-ping-slave-period <%= node["redis"]["repl_ping_slave_period"] %>
#
repl-timeout <%= node["redis"]["repl_timeout"] %>
+# 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.
+#
+# A slave with a low priority number is considered better for promotion, so
+# for instance if there are three slaves with priority 10, 100, 25 Sentinel will
+# pick the one wtih priority 10, that is the lowest.
+#
+# However a special priority of 0 marks the slave as not able to perform the
+# role of master, so a slave with priority of 0 will never be selected by
+# Redis Sentinel for promotion.
+#
+# By default the priority is 100.
+slave-priority <%= node["redis"]["slave_priority"] %>
+
################################## SECURITY ###################################
# Require clients to issue AUTH <PASSWORD> before processing any other
@@ -352,6 +413,24 @@ no-appendfsync-on-rewrite <%= node["redis"]["no_appendfsync_on_rewrite"] %>
auto-aof-rewrite-percentage <%= node["redis"]["auto_aof_rewrite_percentage"] %>
auto-aof-rewrite-min-size <%= node["redis"]["auto_aof_rewrite_min_size"] %>
+################################ LUA SCRIPTING ###############################
+
+# Max execution time of a Lua script in milliseconds.
+#
+# If the maximum execution time is reached Redis will log that a script is
+# still in execution after the maximum allowed time and will start to
+# reply to queries with an error.
+#
+# When a long running script exceed the maximum execution time only the
+# SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be
+# used to stop a script that did not yet called write commands. The second
+# is the only way to shut down the server in the case a write commands was
+# already issue by the script but the user don't want to wait for the natural
+# termination of the script.
+#
+# Set it to 0 or a negative value for unlimited execution without warnings.
+lua-time-limit <%= node["redis"]["lua_time_limit"] %>
+
################################## SLOW LOG ###################################
# The Redis Slow Log is a system to log queries that exceeded a specified
@@ -376,80 +455,6 @@ slowlog-log-slower-than <%= node["redis"]["slowlog_log_slower_than"] %>
# You can reclaim memory used by the slow log with SLOWLOG RESET.
slowlog-max-len <%= node["redis"]["slowlog_max_len"] %>
-################################ VIRTUAL MEMORY ###############################
-
-### WARNING! Virtual Memory is deprecated in Redis 2.4
-### The use of Virtual Memory is strongly discouraged.
-
-# Virtual Memory allows Redis to work with datasets bigger than the actual
-# amount of RAM needed to hold the whole dataset in memory.
-# In order to do so very used keys are taken in memory while the other keys
-# are swapped into a swap file, similarly to what operating systems do
-# with memory pages.
-#
-# To enable VM just set 'vm-enabled' to yes, and set the following three
-# VM parameters accordingly to your needs.
-
-vm-enabled <%= node["redis"]["vm_enabled"] %>
-# vm-enabled yes
-
-# This is the path of the Redis swap file. As you can guess, swap files
-# can't be shared by different Redis instances, so make sure to use a swap
-# file for every redis process you are running. Redis will complain if the
-# swap file is already in use.
-#
-# The best kind of storage for the Redis swap file (that's accessed at random)
-# is a Solid State Disk (SSD).
-#
-# *** WARNING *** if you are using a shared hosting the default of putting
-# the swap file under /tmp is not secure. Create a dir with access granted
-# only to Redis user and configure Redis to create the swap file there.
-vm-swap-file <%= node["redis"]["vm_swap_file"] %>
-
-# vm-max-memory configures the VM to use at max the specified amount of
-# RAM. Everything that deos not fit will be swapped on disk *if* possible, that
-# is, if there is still enough contiguous space in the swap file.
-#
-# With vm-max-memory 0 the system will swap everything it can. Not a good
-# default, just specify the max amount of RAM you can in bytes, but it's
-# better to leave some margin. For instance specify an amount of RAM
-# that's more or less between 60 and 80% of your free RAM.
-vm-max-memory <%= node["redis"]["vm_max_memory"] %>
-
-# Redis swap files is split into pages. An object can be saved using multiple
-# contiguous pages, but pages can't be shared between different objects.
-# So if your page is too big, small objects swapped out on disk will waste
-# a lot of space. If you page is too small, there is less space in the swap
-# file (assuming you configured the same number of total swap file pages).
-#
-# If you use a lot of small objects, use a page size of 64 or 32 bytes.
-# If you use a lot of big objects, use a bigger page size.
-# If unsure, use the default :)
-vm-page-size <%= node["redis"]["vm_page_size"] %>
-
-# Number of total memory pages in the swap file.
-# Given that the page table (a bitmap of free/used pages) is taken in memory,
-# every 8 pages on disk will consume 1 byte of RAM.
-#
-# The total swap size is vm-page-size * vm-pages
-#
-# With the default of 32-bytes memory pages and 134217728 pages Redis will
-# use a 4 GB swap file, that will use 16 MB of RAM for the page table.
-#
-# It's better to use the smallest acceptable value for your application,
-# but the default is large in order to work in most conditions.
-vm-pages <%= node["redis"]["vm_pages"] %>
-
-# Max number of VM I/O threads running at the same time.
-# This threads are used to read/write data from/to swap file, since they
-# also encode and decode objects from disk to memory or the reverse, a bigger
-# number of threads can help with big objects even if they can't help with
-# I/O itself as the physical device may not be able to couple with many
-# reads/writes operations at the same time.
-#
-# The special value of 0 turn off threaded I/O and enables the blocking
-# Virtual Memory implementation.
-vm-max-threads <%= node["redis"]["vm_max_threads"] %>
############################### ADVANCED CONFIG ###############################
@@ -499,6 +504,43 @@ zset-max-ziplist-value <%= node["redis"]["zset_max_ziplist_value"] %>
# want to free memory asap when possible.
activerehashing <%= node["redis"]["activerehashing"] %>
+# 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).
+#
+# The limit can be set differently for the three different classes of clients:
+#
+# normal -> normal clients
+# slave -> slave clients and MONITOR clients
+# pubsub -> clients subcribed to at least one pubsub channel or pattern
+#
+# The syntax of every client-output-buffer-limit directive is the following:
+#
+# client-output-buffer-limit <class> <hard limit> <soft limit> <soft seconds>
+#
+# A client is immediately disconnected once the hard limit is reached, or if
+# the soft limit is reached and remains reached for the specified number of
+# seconds (continuously).
+# So for instance if the hard limit is 32 megabytes and the soft limit is
+# 16 megabytes / 10 seconds, the client will get disconnected immediately
+# if the size of the output buffers reach 32 megabytes, but will also get
+# disconnected if the client reaches 16 megabytes and continuously overcomes
+# the limit for 10 seconds.
+#
+# By default normal clients are not limited because they don't receive data
+# without asking (in a push way), but just after a request, so only
+# asynchronous clients may create a scenario where data is requested faster
+# than it can read.
+#
+# Instead there is a default limit for pubsub and slave clients, since
+# subscribers and slaves receive data in a push fashion.
+#
+# Both the hard or the soft limit can be disabled just setting it to zero.
+client-output-buffer-limit normal <%= node["redis"]["client_output_buffer_limit"]["normal"] %>
+client-output-buffer-limit slave <%= node["redis"]["client_output_buffer_limit"]["slave"] %>
+client-output-buffer-limit pubsub <%= node["redis"]["client_output_buffer_limit"]["pubsub"] %>
+
################################## INCLUDES ###################################
# Include one or more other config files here. This is useful if you

0 comments on commit 44723fb

Please sign in to comment.