Skip to content

Commit 7a0c72f

Browse files
committed
redis_init_script template updated.
1 parent 0d44d50 commit 7a0c72f

File tree

1 file changed

+153
-41
lines changed

1 file changed

+153
-41
lines changed

utils/redis.conf.tpl

Lines changed: 153 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Redis configuration file example
22

3-
# Note on units: when memory size is needed, it is possible to specifiy
3+
# Note on units: when memory size is needed, it is possible to specify
44
# it in the usual form of 1k 5GB 4M and so forth:
55
#
66
# 1k => 1000 bytes
@@ -34,17 +34,18 @@ port $REDIS_PORT
3434
# on a unix socket when not specified.
3535
#
3636
# unixsocket /tmp/redis.sock
37+
# unixsocketperm 755
3738

3839
# Close the connection after a client is idle for N seconds (0 to disable)
39-
timeout 300
40+
timeout 0
4041

4142
# Set server verbosity to 'debug'
4243
# it can be one of:
4344
# debug (a lot of information, useful for development/testing)
4445
# verbose (many rarely useful info, but not a mess like the debug level)
4546
# notice (moderately verbose, what you want in production probably)
4647
# warning (only very important / critical messages are logged)
47-
loglevel verbose
48+
loglevel notice
4849

4950
# Specify the log file name. Also 'stdout' can be used to force
5051
# Redis to log on the standard output. Note that if you use standard
@@ -81,11 +82,32 @@ databases 16
8182
# after 60 sec if at least 10000 keys changed
8283
#
8384
# Note: you can disable saving at all commenting all the "save" lines.
85+
#
86+
# It is also possible to remove all the previously configured save
87+
# points by adding a save directive with a single empty string argument
88+
# like in the following example:
89+
#
90+
# save ""
8491

8592
save 900 1
8693
save 300 10
8794
save 60 10000
8895

96+
# By default Redis will stop accepting writes if RDB snapshots are enabled
97+
# (at least one save point) and the latest background save failed.
98+
# This will make the user aware (in an hard way) that data is not persisting
99+
# on disk properly, otherwise chances are that no one will notice and some
100+
# distater will happen.
101+
#
102+
# If the background saving process will start working again Redis will
103+
# automatically allow writes again.
104+
#
105+
# However if you have setup your proper monitoring of the Redis server
106+
# and persistence, you may want to disable this feature so that Redis will
107+
# continue to work as usually even if there are problems with disk,
108+
# permissions, and so forth.
109+
stop-writes-on-bgsave-error yes
110+
89111
# Compress string objects using LZF when dump .rdb databases?
90112
# For default that's set to 'yes' as it's almost always a win.
91113
# If you want to save some CPU in the saving child set it to 'no' but
@@ -125,7 +147,7 @@ dir $REDIS_DATA_DIR
125147
# is still in progress, the slave can act in two different ways:
126148
#
127149
# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
128-
# still reply to client requests, possibly with out of data data, or the
150+
# still reply to client requests, possibly with out of date data, or the
129151
# data set may just be empty if this is the first synchronization.
130152
#
131153
# 2) if slave-serve-stale data is set to 'no' the slave will reply with
@@ -134,6 +156,21 @@ dir $REDIS_DATA_DIR
134156
#
135157
slave-serve-stale-data yes
136158

159+
# Slaves send PINGs to server in a predefined interval. It's possible to change
160+
# this interval with the repl_ping_slave_period option. The default value is 10
161+
# seconds.
162+
#
163+
# repl-ping-slave-period 10
164+
165+
# The following option sets a timeout for both Bulk transfer I/O timeout and
166+
# master data or ping response timeout. The default value is 60 seconds.
167+
#
168+
# It is important to make sure that this value is greater than the value
169+
# specified for repl-ping-slave-period otherwise a timeout will be detected
170+
# every time there is low traffic between the master and the slave.
171+
#
172+
# repl-timeout 60
173+
137174
################################## SECURITY ###################################
138175

139176
# Require clients to issue AUTH <PASSWORD> before processing any other
@@ -151,7 +188,7 @@ slave-serve-stale-data yes
151188

152189
# Command renaming.
153190
#
154-
# It is possilbe to change the name of dangerous commands in a shared
191+
# It is possible to change the name of dangerous commands in a shared
155192
# environment. For instance the CONFIG command may be renamed into something
156193
# of hard to guess so that it will be still available for internal-use
157194
# tools but not available for general clients.
@@ -160,37 +197,46 @@ slave-serve-stale-data yes
160197
#
161198
# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
162199
#
163-
# It is also possilbe to completely kill a command renaming it into
200+
# It is also possible to completely kill a command renaming it into
164201
# an empty string:
165202
#
166203
# rename-command CONFIG ""
167204

168205
################################### LIMITS ####################################
169206

170-
# Set the max number of connected clients at the same time. By default there
171-
# is no limit, and it's up to the number of file descriptors the Redis process
172-
# is able to open. The special value '0' means no limits.
207+
# Set the max number of connected clients at the same time. By default
208+
# this limit is set to 10000 clients, however if the Redis server is not
209+
# able ot configure the process file limit to allow for the specified limit
210+
# the max number of allowed clients is set to the current file limit
211+
# minus 32 (as Redis reserves a few file descriptors for internal uses).
212+
#
173213
# Once the limit is reached Redis will close all the new connections sending
174214
# an error 'max number of clients reached'.
175215
#
176-
# maxclients 128
216+
# maxclients 10000
177217

178218
# Don't use more memory than the specified amount of bytes.
179-
# When the memory limit is reached Redis will try to remove keys with an
180-
# EXPIRE set. It will try to start freeing keys that are going to expire
181-
# in little time and preserve keys with a longer time to live.
182-
# Redis will also try to remove objects from free lists if possible.
183-
#
184-
# If all this fails, Redis will start to reply with errors to commands
185-
# that will use more memory, like SET, LPUSH, and so on, and will continue
186-
# to reply to most read-only commands like GET.
187-
#
188-
# WARNING: maxmemory can be a good idea mainly if you want to use Redis as a
189-
# 'state' server or cache, not as a real DB. When Redis is used as a real
190-
# database the memory usage will grow over the weeks, it will be obvious if
191-
# it is going to use too much memory in the long run, and you'll have the time
192-
# to upgrade. With maxmemory after the limit is reached you'll start to get
193-
# errors for write operations, and this may even lead to DB inconsistency.
219+
# When the memory limit is reached Redis will try to remove keys
220+
# accordingly to the eviction policy selected (see maxmemmory-policy).
221+
#
222+
# If Redis can't remove keys according to the policy, or if the policy is
223+
# set to 'noeviction', Redis will start to reply with errors to commands
224+
# that would use more memory, like SET, LPUSH, and so on, and will continue
225+
# to reply to read-only commands like GET.
226+
#
227+
# This option is usually useful when using Redis as an LRU cache, or to set
228+
# an hard memory limit for an instance (using the 'noeviction' policy).
229+
#
230+
# WARNING: If you have slaves attached to an instance with maxmemory on,
231+
# the size of the output buffers needed to feed the slaves are subtracted
232+
# from the used memory count, so that network problems / resyncs will
233+
# not trigger a loop where keys are evicted, and in turn the output
234+
# buffer of slaves is full with DELs of keys evicted triggering the deletion
235+
# of more keys, and so forth until the database is completely emptied.
236+
#
237+
# In short... if you have slaves attached it is suggested that you set a lower
238+
# limit for maxmemory so that there is some free RAM on the system for slave
239+
# output buffers (but this is not needed if the policy is 'noeviction').
194240
#
195241
# maxmemory <bytes>
196242

@@ -200,7 +246,7 @@ slave-serve-stale-data yes
200246
# volatile-lru -> remove the key with an expire set using an LRU algorithm
201247
# allkeys-lru -> remove any key accordingly to the LRU algorithm
202248
# volatile-random -> remove a random key with an expire set
203-
# allkeys->random -> remove a random key, any key
249+
# allkeys-random -> remove a random key, any key
204250
# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
205251
# noeviction -> don't expire at all, just return an error on write operations
206252
#
@@ -260,7 +306,7 @@ appendonly no
260306
#
261307
# The default is "everysec" that's usually the right compromise between
262308
# speed and data safety. It's up to you to understand if you can relax this to
263-
# "no" that will will let the operating system flush the output buffer when
309+
# "no" that will let the operating system flush the output buffer when
264310
# it wants, for better performances (but if you can live with the idea of
265311
# some data loss consider the default persistence mode that's snapshotting),
266312
# or on the contrary, use "always" that's very slow but a bit safer than
@@ -284,7 +330,7 @@ appendfsync everysec
284330
# BGSAVE or BGREWRITEAOF is in progress.
285331
#
286332
# This means that while another child is saving the durability of Redis is
287-
# the same as "appendfsync none", that in pratical terms means that it is
333+
# the same as "appendfsync none", that in practical terms means that it is
288334
# possible to lost up to 30 seconds of log in the worst scenario (with the
289335
# default Linux settings).
290336
#
@@ -306,7 +352,7 @@ no-appendfsync-on-rewrite no
306352
# is useful to avoid rewriting the AOF file even if the percentage increase
307353
# is reached but it is still pretty small.
308354
#
309-
# Specify a precentage of zero in order to disable the automatic AOF
355+
# Specify a percentage of zero in order to disable the automatic AOF
310356
# rewrite feature.
311357

312358
auto-aof-rewrite-percentage 100
@@ -315,9 +361,39 @@ auto-aof-rewrite-min-size 64mb
315361
################################ LUA SCRIPTING ###############################
316362

317363
# Max execution time of a Lua script in milliseconds.
318-
# This prevents that a programming error generating an infinite loop will block
319-
# your server forever. Set it to 0 or a negative value for unlimited execution.
320-
#lua-time-limit 60000
364+
#
365+
# If the maximum execution time is reached Redis will log that a script is
366+
# still in execution after the maximum allowed time and will start to
367+
# reply to queries with an error.
368+
#
369+
# When a long running script exceed the maximum execution time only the
370+
# SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be
371+
# used to stop a script that did not yet called write commands. The second
372+
# is the only way to shut down the server in the case a write commands was
373+
# already issue by the script but the user don't want to wait for the natural
374+
# termination of the script.
375+
#
376+
# Set it to 0 or a negative value for unlimited execution without warnings.
377+
lua-time-limit 5000
378+
379+
################################ REDIS CLUSTER ###############################
380+
#
381+
# Normal Redis instances can't be part of a Redis Cluster, only nodes that are
382+
# started as cluster nodes can. In order to start a Redis instance as a
383+
# cluster node enable the cluster support uncommenting the following:
384+
#
385+
# cluster-enabled yes
386+
387+
# Every cluster node has a cluster configuration file. This file is not
388+
# intended to be edited by hand. It is created and updated by Redis nodes.
389+
# Every Redis Cluster node requires a different cluster configuration file.
390+
# Make sure that instances running in the same system does not have
391+
# overlapping cluster configuration file names.
392+
#
393+
# cluster-config-file nodes-6379.conf
394+
395+
# In order to setup your cluster make sure to read the documentation
396+
# available at http://redis.io web site.
321397

322398
################################## SLOW LOG ###################################
323399

@@ -345,12 +421,11 @@ slowlog-max-len 1024
345421

346422
############################### ADVANCED CONFIG ###############################
347423

348-
# Hashes are encoded in a special way (much more memory efficient) when they
349-
# have at max a given numer of elements, and the biggest element does not
350-
# exceed a given threshold. You can configure this limits with the following
351-
# configuration directives.
352-
hash-max-zipmap-entries 512
353-
hash-max-zipmap-value 64
424+
# Hashes are encoded using a memory efficient data structure when they have a
425+
# small number of entries, and the biggest entry does not exceed a given
426+
# threshold. These thresholds can be configured using the following directives.
427+
hash-max-ziplist-entries 512
428+
hash-max-ziplist-value 64
354429

355430
# Similarly to hashes, small lists are also encoded in a special way in order
356431
# to save a lot of space. The special representation is only used when
@@ -373,9 +448,9 @@ zset-max-ziplist-value 64
373448

374449
# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
375450
# order to help rehashing the main Redis hash table (the one mapping top-level
376-
# keys to values). The hash table implementation redis uses (see dict.c)
451+
# keys to values). The hash table implementation Redis uses (see dict.c)
377452
# performs a lazy rehashing: the more operation you run into an hash table
378-
# that is rhashing, the more rehashing "steps" are performed, so if the
453+
# that is rehashing, the more rehashing "steps" are performed, so if the
379454
# server is idle the rehashing is never complete and some more memory is used
380455
# by the hash table.
381456
#
@@ -391,10 +466,47 @@ zset-max-ziplist-value 64
391466
# want to free memory asap when possible.
392467
activerehashing yes
393468

469+
# The client output buffer limits can be used to force disconnection of clients
470+
# that are not reading data from the server fast enough for some reason (a
471+
# common reason is that a Pub/Sub client can't consume messages as fast as the
472+
# publisher can produce them).
473+
#
474+
# The limit can be set differently for the three different classes of clients:
475+
#
476+
# normal -> normal clients
477+
# slave -> slave clients and MONITOR clients
478+
# pubsub -> clients subcribed to at least one pubsub channel or pattern
479+
#
480+
# The syntax of every client-output-buffer-limit directive is the following:
481+
#
482+
# client-output-buffer-limit <class> <hard limit> <soft limit> <soft seconds>
483+
#
484+
# A client is immediately disconnected once the hard limit is reached, or if
485+
# the soft limit is reached and remains reached for the specified number of
486+
# seconds (continuously).
487+
# So for instance if the hard limit is 32 megabytes and the soft limit is
488+
# 16 megabytes / 10 seconds, the client will get disconnected immediately
489+
# if the size of the output buffers reach 32 megabytes, but will also get
490+
# disconnected if the client reaches 16 megabytes and continuously overcomes
491+
# the limit for 10 seconds.
492+
#
493+
# By default normal clients are not limited because they don't receive data
494+
# without asking (in a push way), but just after a request, so only
495+
# asynchronous clients may create a scenario where data is requested faster
496+
# than it can read.
497+
#
498+
# Instead there is a default limit for pubsub and slave clients, since
499+
# subscribers and slaves receive data in a push fashion.
500+
#
501+
# Both the hard or the soft limit can be disabled just setting it to zero.
502+
client-output-buffer-limit normal 0 0 0
503+
client-output-buffer-limit slave 256mb 64mb 60
504+
client-output-buffer-limit pubsub 32mb 8mb 60
505+
394506
################################## INCLUDES ###################################
395507

396508
# Include one or more other config files here. This is useful if you
397-
# have a standard template that goes to all redis server but also need
509+
# have a standard template that goes to all Redis server but also need
398510
# to customize a few per-server settings. Include files can include
399511
# other files, so use this wisely.
400512
#

0 commit comments

Comments
 (0)