xref: /redis-3.2.3/redis.conf (revision a5bb0a07)
1# Redis configuration file example
2
3# Note on units: when memory size is needed, it is possible to specify
4# it in the usual form of 1k 5GB 4M and so forth:
5#
6# 1k => 1000 bytes
7# 1kb => 1024 bytes
8# 1m => 1000000 bytes
9# 1mb => 1024*1024 bytes
10# 1g => 1000000000 bytes
11# 1gb => 1024*1024*1024 bytes
12#
13# units are case insensitive so 1GB 1Gb 1gB are all the same.
14
15################################## INCLUDES ###################################
16
17# Include one or more other config files here.  This is useful if you
18# have a standard template that goes to all Redis servers but also need
19# to customize a few per-server settings.  Include files can include
20# other files, so use this wisely.
21#
22# Notice option "include" won't be rewritten by command "CONFIG REWRITE"
23# from admin or Redis Sentinel. Since Redis always uses the last processed
24# line as value of a configuration directive, you'd better put includes
25# at the beginning of this file to avoid overwriting config change at runtime.
26#
27# If instead you are interested in using includes to override configuration
28# options, it is better to use include as the last line.
29#
30# include /path/to/local.conf
31# include /path/to/other.conf
32
33################################ GENERAL  #####################################
34
35# By default Redis does not run as a daemon. Use 'yes' if you need it.
36# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
37daemonize no
38
39# If you run Redis from upstart or systemd, Redis can interact with your
40# supervision tree. Options:
41#   supervised no      - no supervision interaction
42#   supervised upstart - signal upstart by putting Redis into SIGSTOP mode
43#   supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
44#   supervised auto    - detect upstart or systemd method based on
45#                        UPSTART_JOB or NOTIFY_SOCKET environment variables
46# Note: these supervision methods only signal "process is ready."
47#       They do not enable continuous liveness pings back to your supervisor.
48supervised no
49
50# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
51# default. You can specify a custom pid file location here.
52pidfile /var/run/redis.pid
53
54# Accept connections on the specified port, default is 6379.
55# If port 0 is specified Redis will not listen on a TCP socket.
56port 6379
57
58# TCP listen() backlog.
59#
60# In high requests-per-second environments you need an high backlog in order
61# to avoid slow clients connections issues. Note that the Linux kernel
62# will silently truncate it to the value of /proc/sys/net/core/somaxconn so
63# make sure to raise both the value of somaxconn and tcp_max_syn_backlog
64# in order to get the desired effect.
65tcp-backlog 511
66
67# By default Redis listens for connections from all the network interfaces
68# available on the server. It is possible to listen to just one or multiple
69# interfaces using the "bind" configuration directive, followed by one or
70# more IP addresses.
71#
72# Examples:
73#
74# bind 192.168.1.100 10.0.0.1
75# bind 127.0.0.1
76
77# Specify the path for the Unix socket that will be used to listen for
78# incoming connections. There is no default, so Redis will not listen
79# on a unix socket when not specified.
80#
81# unixsocket /tmp/redis.sock
82# unixsocketperm 700
83
84# Close the connection after a client is idle for N seconds (0 to disable)
85timeout 0
86
87# TCP keepalive.
88#
89# If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence
90# of communication. This is useful for two reasons:
91#
92# 1) Detect dead peers.
93# 2) Take the connection alive from the point of view of network
94#    equipment in the middle.
95#
96# On Linux, the specified value (in seconds) is the period used to send ACKs.
97# Note that to close the connection the double of the time is needed.
98# On other kernels the period depends on the kernel configuration.
99#
100# A reasonable value for this option is 60 seconds.
101tcp-keepalive 0
102
103# Specify the server verbosity level.
104# This can be one of:
105# debug (a lot of information, useful for development/testing)
106# verbose (many rarely useful info, but not a mess like the debug level)
107# notice (moderately verbose, what you want in production probably)
108# warning (only very important / critical messages are logged)
109loglevel notice
110
111# Specify the log file name. Also the empty string can be used to force
112# Redis to log on the standard output. Note that if you use standard
113# output for logging but daemonize, logs will be sent to /dev/null
114logfile ""
115
116# To enable logging to the system logger, just set 'syslog-enabled' to yes,
117# and optionally update the other syslog parameters to suit your needs.
118# syslog-enabled no
119
120# Specify the syslog identity.
121# syslog-ident redis
122
123# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
124# syslog-facility local0
125
126# Set the number of databases. The default database is DB 0, you can select
127# a different one on a per-connection basis using SELECT <dbid> where
128# dbid is a number between 0 and 'databases'-1
129databases 16
130
131################################ SNAPSHOTTING  ################################
132#
133# Save the DB on disk:
134#
135#   save <seconds> <changes>
136#
137#   Will save the DB if both the given number of seconds and the given
138#   number of write operations against the DB occurred.
139#
140#   In the example below the behaviour will be to save:
141#   after 900 sec (15 min) if at least 1 key changed
142#   after 300 sec (5 min) if at least 10 keys changed
143#   after 60 sec if at least 10000 keys changed
144#
145#   Note: you can disable saving completely by commenting out all "save" lines.
146#
147#   It is also possible to remove all the previously configured save
148#   points by adding a save directive with a single empty string argument
149#   like in the following example:
150#
151#   save ""
152
153save 900 1
154save 300 10
155save 60 10000
156
157# By default Redis will stop accepting writes if RDB snapshots are enabled
158# (at least one save point) and the latest background save failed.
159# This will make the user aware (in a hard way) that data is not persisting
160# on disk properly, otherwise chances are that no one will notice and some
161# disaster will happen.
162#
163# If the background saving process will start working again Redis will
164# automatically allow writes again.
165#
166# However if you have setup your proper monitoring of the Redis server
167# and persistence, you may want to disable this feature so that Redis will
168# continue to work as usual even if there are problems with disk,
169# permissions, and so forth.
170stop-writes-on-bgsave-error yes
171
172# Compress string objects using LZF when dump .rdb databases?
173# For default that's set to 'yes' as it's almost always a win.
174# If you want to save some CPU in the saving child set it to 'no' but
175# the dataset will likely be bigger if you have compressible values or keys.
176rdbcompression yes
177
178# Since version 5 of RDB a CRC64 checksum is placed at the end of the file.
179# This makes the format more resistant to corruption but there is a performance
180# hit to pay (around 10%) when saving and loading RDB files, so you can disable it
181# for maximum performances.
182#
183# RDB files created with checksum disabled have a checksum of zero that will
184# tell the loading code to skip the check.
185rdbchecksum yes
186
187# The filename where to dump the DB
188dbfilename dump.rdb
189
190# The working directory.
191#
192# The DB will be written inside this directory, with the filename specified
193# above using the 'dbfilename' configuration directive.
194#
195# The Append Only File will also be created inside this directory.
196#
197# Note that you must specify a directory here, not a file name.
198dir ./
199
200################################# REPLICATION #################################
201
202# Master-Slave replication. Use slaveof to make a Redis instance a copy of
203# another Redis server. A few things to understand ASAP about Redis replication.
204#
205# 1) Redis replication is asynchronous, but you can configure a master to
206#    stop accepting writes if it appears to be not connected with at least
207#    a given number of slaves.
208# 2) Redis slaves are able to perform a partial resynchronization with the
209#    master if the replication link is lost for a relatively small amount of
210#    time. You may want to configure the replication backlog size (see the next
211#    sections of this file) with a sensible value depending on your needs.
212# 3) Replication is automatic and does not need user intervention. After a
213#    network partition slaves automatically try to reconnect to masters
214#    and resynchronize with them.
215#
216# slaveof <masterip> <masterport>
217
218# If the master is password protected (using the "requirepass" configuration
219# directive below) it is possible to tell the slave to authenticate before
220# starting the replication synchronization process, otherwise the master will
221# refuse the slave request.
222#
223# masterauth <master-password>
224
225# When a slave loses its connection with the master, or when the replication
226# is still in progress, the slave can act in two different ways:
227#
228# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
229#    still reply to client requests, possibly with out of date data, or the
230#    data set may just be empty if this is the first synchronization.
231#
232# 2) if slave-serve-stale-data is set to 'no' the slave will reply with
233#    an error "SYNC with master in progress" to all the kind of commands
234#    but to INFO and SLAVEOF.
235#
236slave-serve-stale-data yes
237
238# You can configure a slave instance to accept writes or not. Writing against
239# a slave instance may be useful to store some ephemeral data (because data
240# written on a slave will be easily deleted after resync with the master) but
241# may also cause problems if clients are writing to it because of a
242# misconfiguration.
243#
244# Since Redis 2.6 by default slaves are read-only.
245#
246# Note: read only slaves are not designed to be exposed to untrusted clients
247# on the internet. It's just a protection layer against misuse of the instance.
248# Still a read only slave exports by default all the administrative commands
249# such as CONFIG, DEBUG, and so forth. To a limited extent you can improve
250# security of read only slaves using 'rename-command' to shadow all the
251# administrative / dangerous commands.
252slave-read-only yes
253
254# Replication SYNC strategy: disk or socket.
255#
256# -------------------------------------------------------
257# WARNING: DISKLESS REPLICATION IS EXPERIMENTAL CURRENTLY
258# -------------------------------------------------------
259#
260# New slaves and reconnecting slaves that are not able to continue the replication
261# process just receiving differences, need to do what is called a "full
262# synchronization". An RDB file is transmitted from the master to the slaves.
263# The transmission can happen in two different ways:
264#
265# 1) Disk-backed: The Redis master creates a new process that writes the RDB
266#                 file on disk. Later the file is transferred by the parent
267#                 process to the slaves incrementally.
268# 2) Diskless: The Redis master creates a new process that directly writes the
269#              RDB file to slave sockets, without touching the disk at all.
270#
271# With disk-backed replication, while the RDB file is generated, more slaves
272# can be queued and served with the RDB file as soon as the current child producing
273# the RDB file finishes its work. With diskless replication instead once
274# the transfer starts, new slaves arriving will be queued and a new transfer
275# will start when the current one terminates.
276#
277# When diskless replication is used, the master waits a configurable amount of
278# time (in seconds) before starting the transfer in the hope that multiple slaves
279# will arrive and the transfer can be parallelized.
280#
281# With slow disks and fast (large bandwidth) networks, diskless replication
282# works better.
283repl-diskless-sync no
284
285# When diskless replication is enabled, it is possible to configure the delay
286# the server waits in order to spawn the child that transfers the RDB via socket
287# to the slaves.
288#
289# This is important since once the transfer starts, it is not possible to serve
290# new slaves arriving, that will be queued for the next RDB transfer, so the server
291# waits a delay in order to let more slaves arrive.
292#
293# The delay is specified in seconds, and by default is 5 seconds. To disable
294# it entirely just set it to 0 seconds and the transfer will start ASAP.
295repl-diskless-sync-delay 5
296
297# Slaves send PINGs to server in a predefined interval. It's possible to change
298# this interval with the repl_ping_slave_period option. The default value is 10
299# seconds.
300#
301# repl-ping-slave-period 10
302
303# The following option sets the replication timeout for:
304#
305# 1) Bulk transfer I/O during SYNC, from the point of view of slave.
306# 2) Master timeout from the point of view of slaves (data, pings).
307# 3) Slave timeout from the point of view of masters (REPLCONF ACK pings).
308#
309# It is important to make sure that this value is greater than the value
310# specified for repl-ping-slave-period otherwise a timeout will be detected
311# every time there is low traffic between the master and the slave.
312#
313# repl-timeout 60
314
315# Disable TCP_NODELAY on the slave socket after SYNC?
316#
317# If you select "yes" Redis will use a smaller number of TCP packets and
318# less bandwidth to send data to slaves. But this can add a delay for
319# the data to appear on the slave side, up to 40 milliseconds with
320# Linux kernels using a default configuration.
321#
322# If you select "no" the delay for data to appear on the slave side will
323# be reduced but more bandwidth will be used for replication.
324#
325# By default we optimize for low latency, but in very high traffic conditions
326# or when the master and slaves are many hops away, turning this to "yes" may
327# be a good idea.
328repl-disable-tcp-nodelay no
329
330# Set the replication backlog size. The backlog is a buffer that accumulates
331# slave data when slaves are disconnected for some time, so that when a slave
332# wants to reconnect again, often a full resync is not needed, but a partial
333# resync is enough, just passing the portion of data the slave missed while
334# disconnected.
335#
336# The bigger the replication backlog, the longer the time the slave can be
337# disconnected and later be able to perform a partial resynchronization.
338#
339# The backlog is only allocated once there is at least a slave connected.
340#
341# repl-backlog-size 1mb
342
343# After a master has no longer connected slaves for some time, the backlog
344# will be freed. The following option configures the amount of seconds that
345# need to elapse, starting from the time the last slave disconnected, for
346# the backlog buffer to be freed.
347#
348# A value of 0 means to never release the backlog.
349#
350# repl-backlog-ttl 3600
351
352# The slave priority is an integer number published by Redis in the INFO output.
353# It is used by Redis Sentinel in order to select a slave to promote into a
354# master if the master is no longer working correctly.
355#
356# A slave with a low priority number is considered better for promotion, so
357# for instance if there are three slaves with priority 10, 100, 25 Sentinel will
358# pick the one with priority 10, that is the lowest.
359#
360# However a special priority of 0 marks the slave as not able to perform the
361# role of master, so a slave with priority of 0 will never be selected by
362# Redis Sentinel for promotion.
363#
364# By default the priority is 100.
365slave-priority 100
366
367# It is possible for a master to stop accepting writes if there are less than
368# N slaves connected, having a lag less or equal than M seconds.
369#
370# The N slaves need to be in "online" state.
371#
372# The lag in seconds, that must be <= the specified value, is calculated from
373# the last ping received from the slave, that is usually sent every second.
374#
375# This option does not GUARANTEE that N replicas will accept the write, but
376# will limit the window of exposure for lost writes in case not enough slaves
377# are available, to the specified number of seconds.
378#
379# For example to require at least 3 slaves with a lag <= 10 seconds use:
380#
381# min-slaves-to-write 3
382# min-slaves-max-lag 10
383#
384# Setting one or the other to 0 disables the feature.
385#
386# By default min-slaves-to-write is set to 0 (feature disabled) and
387# min-slaves-max-lag is set to 10.
388
389################################## SECURITY ###################################
390
391# Require clients to issue AUTH <PASSWORD> before processing any other
392# commands.  This might be useful in environments in which you do not trust
393# others with access to the host running redis-server.
394#
395# This should stay commented out for backward compatibility and because most
396# people do not need auth (e.g. they run their own servers).
397#
398# Warning: since Redis is pretty fast an outside user can try up to
399# 150k passwords per second against a good box. This means that you should
400# use a very strong password otherwise it will be very easy to break.
401#
402# requirepass foobared
403
404# Command renaming.
405#
406# It is possible to change the name of dangerous commands in a shared
407# environment. For instance the CONFIG command may be renamed into something
408# hard to guess so that it will still be available for internal-use tools
409# but not available for general clients.
410#
411# Example:
412#
413# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
414#
415# It is also possible to completely kill a command by renaming it into
416# an empty string:
417#
418# rename-command CONFIG ""
419#
420# Please note that changing the name of commands that are logged into the
421# AOF file or transmitted to slaves may cause problems.
422
423################################### LIMITS ####################################
424
425# Set the max number of connected clients at the same time. By default
426# this limit is set to 10000 clients, however if the Redis server is not
427# able to configure the process file limit to allow for the specified limit
428# the max number of allowed clients is set to the current file limit
429# minus 32 (as Redis reserves a few file descriptors for internal uses).
430#
431# Once the limit is reached Redis will close all the new connections sending
432# an error 'max number of clients reached'.
433#
434# maxclients 10000
435
436# Don't use more memory than the specified amount of bytes.
437# When the memory limit is reached Redis will try to remove keys
438# according to the eviction policy selected (see maxmemory-policy).
439#
440# If Redis can't remove keys according to the policy, or if the policy is
441# set to 'noeviction', Redis will start to reply with errors to commands
442# that would use more memory, like SET, LPUSH, and so on, and will continue
443# to reply to read-only commands like GET.
444#
445# This option is usually useful when using Redis as an LRU cache, or to set
446# a hard memory limit for an instance (using the 'noeviction' policy).
447#
448# WARNING: If you have slaves attached to an instance with maxmemory on,
449# the size of the output buffers needed to feed the slaves are subtracted
450# from the used memory count, so that network problems / resyncs will
451# not trigger a loop where keys are evicted, and in turn the output
452# buffer of slaves is full with DELs of keys evicted triggering the deletion
453# of more keys, and so forth until the database is completely emptied.
454#
455# In short... if you have slaves attached it is suggested that you set a lower
456# limit for maxmemory so that there is some free RAM on the system for slave
457# output buffers (but this is not needed if the policy is 'noeviction').
458#
459# maxmemory <bytes>
460
461# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
462# is reached. You can select among five behaviors:
463#
464# volatile-lru -> remove the key with an expire set using an LRU algorithm
465# allkeys-lru -> remove any key according to the LRU algorithm
466# volatile-random -> remove a random key with an expire set
467# allkeys-random -> remove a random key, any key
468# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
469# noeviction -> don't expire at all, just return an error on write operations
470#
471# Note: with any of the above policies, Redis will return an error on write
472#       operations, when there are no suitable keys for eviction.
473#
474#       At the date of writing these commands are: set setnx setex append
475#       incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd
476#       sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby
477#       zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby
478#       getset mset msetnx exec sort
479#
480# The default is:
481#
482# maxmemory-policy noeviction
483
484# LRU and minimal TTL algorithms are not precise algorithms but approximated
485# algorithms (in order to save memory), so you can tune it for speed or
486# accuracy. For default Redis will check five keys and pick the one that was
487# used less recently, you can change the sample size using the following
488# configuration directive.
489#
490# The default of 5 produces good enough results. 10 Approximates very closely
491# true LRU but costs a bit more CPU. 3 is very fast but not very accurate.
492#
493# maxmemory-samples 5
494
495############################## APPEND ONLY MODE ###############################
496
497# By default Redis asynchronously dumps the dataset on disk. This mode is
498# good enough in many applications, but an issue with the Redis process or
499# a power outage may result into a few minutes of writes lost (depending on
500# the configured save points).
501#
502# The Append Only File is an alternative persistence mode that provides
503# much better durability. For instance using the default data fsync policy
504# (see later in the config file) Redis can lose just one second of writes in a
505# dramatic event like a server power outage, or a single write if something
506# wrong with the Redis process itself happens, but the operating system is
507# still running correctly.
508#
509# AOF and RDB persistence can be enabled at the same time without problems.
510# If the AOF is enabled on startup Redis will load the AOF, that is the file
511# with the better durability guarantees.
512#
513# Please check http://redis.io/topics/persistence for more information.
514
515appendonly no
516
517# The name of the append only file (default: "appendonly.aof")
518
519appendfilename "appendonly.aof"
520
521# The fsync() call tells the Operating System to actually write data on disk
522# instead of waiting for more data in the output buffer. Some OS will really flush
523# data on disk, some other OS will just try to do it ASAP.
524#
525# Redis supports three different modes:
526#
527# no: don't fsync, just let the OS flush the data when it wants. Faster.
528# always: fsync after every write to the append only log. Slow, Safest.
529# everysec: fsync only one time every second. Compromise.
530#
531# The default is "everysec", as that's usually the right compromise between
532# speed and data safety. It's up to you to understand if you can relax this to
533# "no" that will let the operating system flush the output buffer when
534# it wants, for better performances (but if you can live with the idea of
535# some data loss consider the default persistence mode that's snapshotting),
536# or on the contrary, use "always" that's very slow but a bit safer than
537# everysec.
538#
539# More details please check the following article:
540# http://antirez.com/post/redis-persistence-demystified.html
541#
542# If unsure, use "everysec".
543
544# appendfsync always
545appendfsync everysec
546# appendfsync no
547
548# When the AOF fsync policy is set to always or everysec, and a background
549# saving process (a background save or AOF log background rewriting) is
550# performing a lot of I/O against the disk, in some Linux configurations
551# Redis may block too long on the fsync() call. Note that there is no fix for
552# this currently, as even performing fsync in a different thread will block
553# our synchronous write(2) call.
554#
555# In order to mitigate this problem it's possible to use the following option
556# that will prevent fsync() from being called in the main process while a
557# BGSAVE or BGREWRITEAOF is in progress.
558#
559# This means that while another child is saving, the durability of Redis is
560# the same as "appendfsync none". In practical terms, this means that it is
561# possible to lose up to 30 seconds of log in the worst scenario (with the
562# default Linux settings).
563#
564# If you have latency problems turn this to "yes". Otherwise leave it as
565# "no" that is the safest pick from the point of view of durability.
566
567no-appendfsync-on-rewrite no
568
569# Automatic rewrite of the append only file.
570# Redis is able to automatically rewrite the log file implicitly calling
571# BGREWRITEAOF when the AOF log size grows by the specified percentage.
572#
573# This is how it works: Redis remembers the size of the AOF file after the
574# latest rewrite (if no rewrite has happened since the restart, the size of
575# the AOF at startup is used).
576#
577# This base size is compared to the current size. If the current size is
578# bigger than the specified percentage, the rewrite is triggered. Also
579# you need to specify a minimal size for the AOF file to be rewritten, this
580# is useful to avoid rewriting the AOF file even if the percentage increase
581# is reached but it is still pretty small.
582#
583# Specify a percentage of zero in order to disable the automatic AOF
584# rewrite feature.
585
586auto-aof-rewrite-percentage 100
587auto-aof-rewrite-min-size 64mb
588
589# An AOF file may be found to be truncated at the end during the Redis
590# startup process, when the AOF data gets loaded back into memory.
591# This may happen when the system where Redis is running
592# crashes, especially when an ext4 filesystem is mounted without the
593# data=ordered option (however this can't happen when Redis itself
594# crashes or aborts but the operating system still works correctly).
595#
596# Redis can either exit with an error when this happens, or load as much
597# data as possible (the default now) and start if the AOF file is found
598# to be truncated at the end. The following option controls this behavior.
599#
600# If aof-load-truncated is set to yes, a truncated AOF file is loaded and
601# the Redis server starts emitting a log to inform the user of the event.
602# Otherwise if the option is set to no, the server aborts with an error
603# and refuses to start. When the option is set to no, the user requires
604# to fix the AOF file using the "redis-check-aof" utility before to restart
605# the server.
606#
607# Note that if the AOF file will be found to be corrupted in the middle
608# the server will still exit with an error. This option only applies when
609# Redis will try to read more data from the AOF file but not enough bytes
610# will be found.
611aof-load-truncated yes
612
613################################ LUA SCRIPTING  ###############################
614
615# Max execution time of a Lua script in milliseconds.
616#
617# If the maximum execution time is reached Redis will log that a script is
618# still in execution after the maximum allowed time and will start to
619# reply to queries with an error.
620#
621# When a long running script exceeds the maximum execution time only the
622# SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be
623# used to stop a script that did not yet called write commands. The second
624# is the only way to shut down the server in the case a write command was
625# already issued by the script but the user doesn't want to wait for the natural
626# termination of the script.
627#
628# Set it to 0 or a negative value for unlimited execution without warnings.
629lua-time-limit 5000
630
631################################ REDIS CLUSTER  ###############################
632#
633# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
634# WARNING EXPERIMENTAL: Redis Cluster is considered to be stable code, however
635# in order to mark it as "mature" we need to wait for a non trivial percentage
636# of users to deploy it in production.
637# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
638#
639# Normal Redis instances can't be part of a Redis Cluster; only nodes that are
640# started as cluster nodes can. In order to start a Redis instance as a
641# cluster node enable the cluster support uncommenting the following:
642#
643# cluster-enabled yes
644
645# Every cluster node has a cluster configuration file. This file is not
646# intended to be edited by hand. It is created and updated by Redis nodes.
647# Every Redis Cluster node requires a different cluster configuration file.
648# Make sure that instances running in the same system do not have
649# overlapping cluster configuration file names.
650#
651# cluster-config-file nodes-6379.conf
652
653# Cluster node timeout is the amount of milliseconds a node must be unreachable
654# for it to be considered in failure state.
655# Most other internal time limits are multiple of the node timeout.
656#
657# cluster-node-timeout 15000
658
659# A slave of a failing master will avoid to start a failover if its data
660# looks too old.
661#
662# There is no simple way for a slave to actually have a exact measure of
663# its "data age", so the following two checks are performed:
664#
665# 1) If there are multiple slaves able to failover, they exchange messages
666#    in order to try to give an advantage to the slave with the best
667#    replication offset (more data from the master processed).
668#    Slaves will try to get their rank by offset, and apply to the start
669#    of the failover a delay proportional to their rank.
670#
671# 2) Every single slave computes the time of the last interaction with
672#    its master. This can be the last ping or command received (if the master
673#    is still in the "connected" state), or the time that elapsed since the
674#    disconnection with the master (if the replication link is currently down).
675#    If the last interaction is too old, the slave will not try to failover
676#    at all.
677#
678# The point "2" can be tuned by user. Specifically a slave will not perform
679# the failover if, since the last interaction with the master, the time
680# elapsed is greater than:
681#
682#   (node-timeout * slave-validity-factor) + repl-ping-slave-period
683#
684# So for example if node-timeout is 30 seconds, and the slave-validity-factor
685# is 10, and assuming a default repl-ping-slave-period of 10 seconds, the
686# slave will not try to failover if it was not able to talk with the master
687# for longer than 310 seconds.
688#
689# A large slave-validity-factor may allow slaves with too old data to failover
690# a master, while a too small value may prevent the cluster from being able to
691# elect a slave at all.
692#
693# For maximum availability, it is possible to set the slave-validity-factor
694# to a value of 0, which means, that slaves will always try to failover the
695# master regardless of the last time they interacted with the master.
696# (However they'll always try to apply a delay proportional to their
697# offset rank).
698#
699# Zero is the only value able to guarantee that when all the partitions heal
700# the cluster will always be able to continue.
701#
702# cluster-slave-validity-factor 10
703
704# Cluster slaves are able to migrate to orphaned masters, that are masters
705# that are left without working slaves. This improves the cluster ability
706# to resist to failures as otherwise an orphaned master can't be failed over
707# in case of failure if it has no working slaves.
708#
709# Slaves migrate to orphaned masters only if there are still at least a
710# given number of other working slaves for their old master. This number
711# is the "migration barrier". A migration barrier of 1 means that a slave
712# will migrate only if there is at least 1 other working slave for its master
713# and so forth. It usually reflects the number of slaves you want for every
714# master in your cluster.
715#
716# Default is 1 (slaves migrate only if their masters remain with at least
717# one slave). To disable migration just set it to a very large value.
718# A value of 0 can be set but is useful only for debugging and dangerous
719# in production.
720#
721# cluster-migration-barrier 1
722
723# By default Redis Cluster nodes stop accepting queries if they detect there
724# is at least an hash slot uncovered (no available node is serving it).
725# This way if the cluster is partially down (for example a range of hash slots
726# are no longer covered) all the cluster becomes, eventually, unavailable.
727# It automatically returns available as soon as all the slots are covered again.
728#
729# However sometimes you want the subset of the cluster which is working,
730# to continue to accept queries for the part of the key space that is still
731# covered. In order to do so, just set the cluster-require-full-coverage
732# option to no.
733#
734# cluster-require-full-coverage yes
735
736# In order to setup your cluster make sure to read the documentation
737# available at http://redis.io web site.
738
739################################## SLOW LOG ###################################
740
741# The Redis Slow Log is a system to log queries that exceeded a specified
742# execution time. The execution time does not include the I/O operations
743# like talking with the client, sending the reply and so forth,
744# but just the time needed to actually execute the command (this is the only
745# stage of command execution where the thread is blocked and can not serve
746# other requests in the meantime).
747#
748# You can configure the slow log with two parameters: one tells Redis
749# what is the execution time, in microseconds, to exceed in order for the
750# command to get logged, and the other parameter is the length of the
751# slow log. When a new command is logged the oldest one is removed from the
752# queue of logged commands.
753
754# The following time is expressed in microseconds, so 1000000 is equivalent
755# to one second. Note that a negative number disables the slow log, while
756# a value of zero forces the logging of every command.
757slowlog-log-slower-than 10000
758
759# There is no limit to this length. Just be aware that it will consume memory.
760# You can reclaim memory used by the slow log with SLOWLOG RESET.
761slowlog-max-len 128
762
763################################ LATENCY MONITOR ##############################
764
765# The Redis latency monitoring subsystem samples different operations
766# at runtime in order to collect data related to possible sources of
767# latency of a Redis instance.
768#
769# Via the LATENCY command this information is available to the user that can
770# print graphs and obtain reports.
771#
772# The system only logs operations that were performed in a time equal or
773# greater than the amount of milliseconds specified via the
774# latency-monitor-threshold configuration directive. When its value is set
775# to zero, the latency monitor is turned off.
776#
777# By default latency monitoring is disabled since it is mostly not needed
778# if you don't have latency issues, and collecting data has a performance
779# impact, that while very small, can be measured under big load. Latency
780# monitoring can easily be enabled at runtime using the command
781# "CONFIG SET latency-monitor-threshold <milliseconds>" if needed.
782latency-monitor-threshold 0
783
784############################# Event notification ##############################
785
786# Redis can notify Pub/Sub clients about events happening in the key space.
787# This feature is documented at http://redis.io/topics/notifications
788#
789# For instance if keyspace events notification is enabled, and a client
790# performs a DEL operation on key "foo" stored in the Database 0, two
791# messages will be published via Pub/Sub:
792#
793# PUBLISH __keyspace@0__:foo del
794# PUBLISH __keyevent@0__:del foo
795#
796# It is possible to select the events that Redis will notify among a set
797# of classes. Every class is identified by a single character:
798#
799#  K     Keyspace events, published with __keyspace@<db>__ prefix.
800#  E     Keyevent events, published with __keyevent@<db>__ prefix.
801#  g     Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ...
802#  $     String commands
803#  l     List commands
804#  s     Set commands
805#  h     Hash commands
806#  z     Sorted set commands
807#  x     Expired events (events generated every time a key expires)
808#  e     Evicted events (events generated when a key is evicted for maxmemory)
809#  A     Alias for g$lshzxe, so that the "AKE" string means all the events.
810#
811#  The "notify-keyspace-events" takes as argument a string that is composed
812#  of zero or multiple characters. The empty string means that notifications
813#  are disabled.
814#
815#  Example: to enable list and generic events, from the point of view of the
816#           event name, use:
817#
818#  notify-keyspace-events Elg
819#
820#  Example 2: to get the stream of the expired keys subscribing to channel
821#             name __keyevent@0__:expired use:
822#
823#  notify-keyspace-events Ex
824#
825#  By default all notifications are disabled because most users don't need
826#  this feature and the feature has some overhead. Note that if you don't
827#  specify at least one of K or E, no events will be delivered.
828notify-keyspace-events ""
829
830############################### ADVANCED CONFIG ###############################
831
832# Hashes are encoded using a memory efficient data structure when they have a
833# small number of entries, and the biggest entry does not exceed a given
834# threshold. These thresholds can be configured using the following directives.
835hash-max-ziplist-entries 512
836hash-max-ziplist-value 64
837
838# Lists are also encoded in a special way to save a lot of space.
839# The number of entries allowed per internal list node can be specified
840# as a fixed maximum size or a maximum number of elements.
841# For a fixed maximum size, use -5 through -1, meaning:
842# -5: max size: 64 Kb  <-- not recommended for normal workloads
843# -4: max size: 32 Kb  <-- not recommended
844# -3: max size: 16 Kb  <-- probably not recommended
845# -2: max size: 8 Kb   <-- good
846# -1: max size: 4 Kb   <-- good
847# Positive numbers mean store up to _exactly_ that number of elements
848# per list node.
849# The highest performing option is usually -2 (8 Kb size) or -1 (4 Kb size),
850# but if your use case is unique, adjust the settings as necessary.
851list-max-ziplist-size -2
852
853# Lists may also be compressed.
854# Compress depth is the number of quicklist ziplist nodes from *each* side of
855# the list to *exclude* from compression.  The head and tail of the list
856# are always uncompressed for fast push/pop operations.  Settings are:
857# 0: disable all list compression
858# 1: depth 1 means "don't start compressing until after 1 node into the list,
859#    going from either the head or tail"
860#    So: [head]->node->node->...->node->[tail]
861#    [head], [tail] will always be uncompressed; inner nodes will compress.
862# 2: [head]->[next]->node->node->...->node->[prev]->[tail]
863#    2 here means: don't compress head or head->next or tail->prev or tail,
864#    but compress all nodes between them.
865# 3: [head]->[next]->[next]->node->node->...->node->[prev]->[prev]->[tail]
866# etc.
867list-compress-depth 0
868
869# Sets have a special encoding in just one case: when a set is composed
870# of just strings that happen to be integers in radix 10 in the range
871# of 64 bit signed integers.
872# The following configuration setting sets the limit in the size of the
873# set in order to use this special memory saving encoding.
874set-max-intset-entries 512
875
876# Similarly to hashes and lists, sorted sets are also specially encoded in
877# order to save a lot of space. This encoding is only used when the length and
878# elements of a sorted set are below the following limits:
879zset-max-ziplist-entries 128
880zset-max-ziplist-value 64
881
882# HyperLogLog sparse representation bytes limit. The limit includes the
883# 16 bytes header. When an HyperLogLog using the sparse representation crosses
884# this limit, it is converted into the dense representation.
885#
886# A value greater than 16000 is totally useless, since at that point the
887# dense representation is more memory efficient.
888#
889# The suggested value is ~ 3000 in order to have the benefits of
890# the space efficient encoding without slowing down too much PFADD,
891# which is O(N) with the sparse encoding. The value can be raised to
892# ~ 10000 when CPU is not a concern, but space is, and the data set is
893# composed of many HyperLogLogs with cardinality in the 0 - 15000 range.
894hll-sparse-max-bytes 3000
895
896# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
897# order to help rehashing the main Redis hash table (the one mapping top-level
898# keys to values). The hash table implementation Redis uses (see dict.c)
899# performs a lazy rehashing: the more operation you run into a hash table
900# that is rehashing, the more rehashing "steps" are performed, so if the
901# server is idle the rehashing is never complete and some more memory is used
902# by the hash table.
903#
904# The default is to use this millisecond 10 times every second in order to
905# actively rehash the main dictionaries, freeing memory when possible.
906#
907# If unsure:
908# use "activerehashing no" if you have hard latency requirements and it is
909# not a good thing in your environment that Redis can reply from time to time
910# to queries with 2 milliseconds delay.
911#
912# use "activerehashing yes" if you don't have such hard requirements but
913# want to free memory asap when possible.
914activerehashing yes
915
916# The client output buffer limits can be used to force disconnection of clients
917# that are not reading data from the server fast enough for some reason (a
918# common reason is that a Pub/Sub client can't consume messages as fast as the
919# publisher can produce them).
920#
921# The limit can be set differently for the three different classes of clients:
922#
923# normal -> normal clients including MONITOR clients
924# slave  -> slave clients
925# pubsub -> clients subscribed to at least one pubsub channel or pattern
926#
927# The syntax of every client-output-buffer-limit directive is the following:
928#
929# client-output-buffer-limit <class> <hard limit> <soft limit> <soft seconds>
930#
931# A client is immediately disconnected once the hard limit is reached, or if
932# the soft limit is reached and remains reached for the specified number of
933# seconds (continuously).
934# So for instance if the hard limit is 32 megabytes and the soft limit is
935# 16 megabytes / 10 seconds, the client will get disconnected immediately
936# if the size of the output buffers reach 32 megabytes, but will also get
937# disconnected if the client reaches 16 megabytes and continuously overcomes
938# the limit for 10 seconds.
939#
940# By default normal clients are not limited because they don't receive data
941# without asking (in a push way), but just after a request, so only
942# asynchronous clients may create a scenario where data is requested faster
943# than it can read.
944#
945# Instead there is a default limit for pubsub and slave clients, since
946# subscribers and slaves receive data in a push fashion.
947#
948# Both the hard or the soft limit can be disabled by setting them to zero.
949client-output-buffer-limit normal 0 0 0
950client-output-buffer-limit slave 256mb 64mb 60
951client-output-buffer-limit pubsub 32mb 8mb 60
952
953# Redis calls an internal function to perform many background tasks, like
954# closing connections of clients in timeout, purging expired keys that are
955# never requested, and so forth.
956#
957# Not all tasks are performed with the same frequency, but Redis checks for
958# tasks to perform according to the specified "hz" value.
959#
960# By default "hz" is set to 10. Raising the value will use more CPU when
961# Redis is idle, but at the same time will make Redis more responsive when
962# there are many keys expiring at the same time, and timeouts may be
963# handled with more precision.
964#
965# The range is between 1 and 500, however a value over 100 is usually not
966# a good idea. Most users should use the default of 10 and raise this up to
967# 100 only in environments where very low latency is required.
968hz 10
969
970# When a child rewrites the AOF file, if the following option is enabled
971# the file will be fsync-ed every 32 MB of data generated. This is useful
972# in order to commit the file to the disk more incrementally and avoid
973# big latency spikes.
974aof-rewrite-incremental-fsync yes
975