xref: /freebsd/contrib/unbound/testdata/redis_reconnect_interval.tdir/redis.conf (revision b2efd602aea8b3cbc3fb215b9611946d04fceb10)
1*b2efd602SCy Schubert###
2*b2efd602SCy Schubert###  Settings for this test ###################################################
3*b2efd602SCy Schubert###
4*b2efd602SCy Schubert
5*b2efd602SCy Schubert# Accept connections on the specified port, default is 6379 (IANA #815344).
6*b2efd602SCy Schubert# If port 0 is specified Redis will not listen on a TCP socket.
7*b2efd602SCy Schubertport 0
8*b2efd602SCy Schubert
9*b2efd602SCy Schubert# Unix socket.
10*b2efd602SCy Schubert#
11*b2efd602SCy Schubert# Specify the path for the Unix socket that will be used to listen for
12*b2efd602SCy Schubert# incoming connections. There is no default, so Redis will not listen
13*b2efd602SCy Schubert# on a unix socket when not specified.
14*b2efd602SCy Schubert#
15*b2efd602SCy Schubertunixsocket @SOCKET@
16*b2efd602SCy Schubert# unixsocketperm 700
17*b2efd602SCy Schubert
18*b2efd602SCy Schubert# By default Redis does not run as a daemon. Use 'yes' if you need it.
19*b2efd602SCy Schubert# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
20*b2efd602SCy Schubert# When Redis is supervised by upstart or systemd, this parameter has no impact.
21*b2efd602SCy Schubertdaemonize no
22*b2efd602SCy Schubert
23*b2efd602SCy Schubert# Specify the server verbosity level.
24*b2efd602SCy Schubert# This can be one of:
25*b2efd602SCy Schubert# debug (a lot of information, useful for development/testing)
26*b2efd602SCy Schubert# verbose (many rarely useful info, but not a mess like the debug level)
27*b2efd602SCy Schubert# notice (moderately verbose, what you want in production probably)
28*b2efd602SCy Schubert# warning (only very important / critical messages are logged)
29*b2efd602SCy Schubert# nothing (nothing is logged)
30*b2efd602SCy Schubertloglevel notice
31*b2efd602SCy Schubert
32*b2efd602SCy Schubert# Specify the log file name. Also the empty string can be used to force
33*b2efd602SCy Schubert# Redis to log on the standard output. Note that if you use standard
34*b2efd602SCy Schubert# output for logging but daemonize, logs will be sent to /dev/null
35*b2efd602SCy Schubertlogfile @LOGFILE@
36*b2efd602SCy Schubert
37*b2efd602SCy Schubert# To enable logging to the system logger, just set 'syslog-enabled' to yes,
38*b2efd602SCy Schubert# and optionally update the other syslog parameters to suit your needs.
39*b2efd602SCy Schubertsyslog-enabled no
40*b2efd602SCy Schubert
41*b2efd602SCy Schubert# Set the number of databases. The default database is DB 0, you can select
42*b2efd602SCy Schubert# a different one on a per-connection basis using SELECT <dbid> where
43*b2efd602SCy Schubert# dbid is a number between 0 and 'databases'-1
44*b2efd602SCy Schubertdatabases 2
45*b2efd602SCy Schubert
46*b2efd602SCy Schubert# Snapshotting can be completely disabled with a single empty string argument
47*b2efd602SCy Schubert# as in following example:
48*b2efd602SCy Schubert#
49*b2efd602SCy Schubertsave ""
50*b2efd602SCy Schubert
51*b2efd602SCy Schubert# The working directory.
52*b2efd602SCy Schubert#
53*b2efd602SCy Schubert# The DB will be written inside this directory, with the filename specified
54*b2efd602SCy Schubert# above using the 'dbfilename' configuration directive.
55*b2efd602SCy Schubert#
56*b2efd602SCy Schubert# The Append Only File will also be created inside this directory.
57*b2efd602SCy Schubert#
58*b2efd602SCy Schubert# Note that you must specify a directory here, not a file name.
59*b2efd602SCy Schubertdir .
60*b2efd602SCy Schubert
61*b2efd602SCy Schubert###
62*b2efd602SCy Schubert###  Rest of the default Redis settings #######################################
63*b2efd602SCy Schubert###
64*b2efd602SCy Schubert
65*b2efd602SCy Schubertbind 127.0.0.1 -::1
66*b2efd602SCy Schubert
67*b2efd602SCy Schubert# When protected mode is on and the default user has no password, the server
68*b2efd602SCy Schubert# only accepts local connections from the IPv4 address (127.0.0.1), IPv6 address
69*b2efd602SCy Schubert# (::1) or Unix domain sockets.
70*b2efd602SCy Schubertprotected-mode yes
71*b2efd602SCy Schubert
72*b2efd602SCy Schubert# TCP listen() backlog.
73*b2efd602SCy Schubert#
74*b2efd602SCy Schubert# In high requests-per-second environments you need a high backlog in order
75*b2efd602SCy Schubert# to avoid slow clients connection issues. Note that the Linux kernel
76*b2efd602SCy Schubert# will silently truncate it to the value of /proc/sys/net/core/somaxconn so
77*b2efd602SCy Schubert# make sure to raise both the value of somaxconn and tcp_max_syn_backlog
78*b2efd602SCy Schubert# in order to get the desired effect.
79*b2efd602SCy Schuberttcp-backlog 511
80*b2efd602SCy Schubert
81*b2efd602SCy Schubert# Close the connection after a client is idle for N seconds (0 to disable)
82*b2efd602SCy Schuberttimeout 0
83*b2efd602SCy Schubert
84*b2efd602SCy Schubert# TCP keepalive.
85*b2efd602SCy Schubert# A reasonable value for this option is 300 seconds, which is the new
86*b2efd602SCy Schubert# Redis default starting with Redis 3.2.1.
87*b2efd602SCy Schuberttcp-keepalive 300
88*b2efd602SCy Schubert
89*b2efd602SCy Schubert# By default Redis shows an ASCII art logo only when started to log to the
90*b2efd602SCy Schubert# standard output and if the standard output is a TTY and syslog logging is
91*b2efd602SCy Schubert# disabled. Basically this means that normally a logo is displayed only in
92*b2efd602SCy Schubert# interactive sessions.
93*b2efd602SCy Schubert#
94*b2efd602SCy Schubert# However it is possible to force the pre-4.0 behavior and always show a
95*b2efd602SCy Schubert# ASCII art logo in startup logs by setting the following option to yes.
96*b2efd602SCy Schubertalways-show-logo no
97*b2efd602SCy Schubert
98*b2efd602SCy Schubert# By default, Redis modifies the process title (as seen in 'top' and 'ps') to
99*b2efd602SCy Schubert# provide some runtime information. It is possible to disable this and leave
100*b2efd602SCy Schubert# the process name as executed by setting the following to no.
101*b2efd602SCy Schubertset-proc-title yes
102*b2efd602SCy Schubert
103*b2efd602SCy Schubert# When changing the process title, Redis uses the following template to construct
104*b2efd602SCy Schubert# the modified title.
105*b2efd602SCy Schubert#
106*b2efd602SCy Schubert# Template variables are specified in curly brackets. The following variables are
107*b2efd602SCy Schubert# supported:
108*b2efd602SCy Schubert#
109*b2efd602SCy Schubert# {title}           Name of process as executed if parent, or type of child process.
110*b2efd602SCy Schubert# {listen-addr}     Bind address or '*' followed by TCP or TLS port listening on, or
111*b2efd602SCy Schubert#                   Unix socket if only that's available.
112*b2efd602SCy Schubert# {server-mode}     Special mode, i.e. "[sentinel]" or "[cluster]".
113*b2efd602SCy Schubert# {port}            TCP port listening on, or 0.
114*b2efd602SCy Schubert# {tls-port}        TLS port listening on, or 0.
115*b2efd602SCy Schubert# {unixsocket}      Unix domain socket listening on, or "".
116*b2efd602SCy Schubert# {config-file}     Name of configuration file used.
117*b2efd602SCy Schubert#
118*b2efd602SCy Schubertproc-title-template "{title} {listen-addr} {server-mode}"
119*b2efd602SCy Schubert
120*b2efd602SCy Schubert# Set the local environment which is used for string comparison operations, and
121*b2efd602SCy Schubert# also affect the performance of Lua scripts. Empty String indicates the locale
122*b2efd602SCy Schubert# is derived from the environment variables.
123*b2efd602SCy Schubert#locale-collate ""
124*b2efd602SCy Schubert
125*b2efd602SCy Schubert# By default Redis will stop accepting writes if RDB snapshots are enabled
126*b2efd602SCy Schubert# (at least one save point) and the latest background save failed.
127*b2efd602SCy Schubert# This will make the user aware (in a hard way) that data is not persisting
128*b2efd602SCy Schubert# on disk properly, otherwise chances are that no one will notice and some
129*b2efd602SCy Schubert# disaster will happen.
130*b2efd602SCy Schubert#
131*b2efd602SCy Schubert# If the background saving process will start working again Redis will
132*b2efd602SCy Schubert# automatically allow writes again.
133*b2efd602SCy Schubert#
134*b2efd602SCy Schubert# However if you have setup your proper monitoring of the Redis server
135*b2efd602SCy Schubert# and persistence, you may want to disable this feature so that Redis will
136*b2efd602SCy Schubert# continue to work as usual even if there are problems with disk,
137*b2efd602SCy Schubert# permissions, and so forth.
138*b2efd602SCy Schubertstop-writes-on-bgsave-error yes
139*b2efd602SCy Schubert
140*b2efd602SCy Schubert# Compress string objects using LZF when dump .rdb databases?
141*b2efd602SCy Schubert# By default compression is enabled as it's almost always a win.
142*b2efd602SCy Schubert# If you want to save some CPU in the saving child set it to 'no' but
143*b2efd602SCy Schubert# the dataset will likely be bigger if you have compressible values or keys.
144*b2efd602SCy Schubertrdbcompression yes
145*b2efd602SCy Schubert
146*b2efd602SCy Schubert# Since version 5 of RDB a CRC64 checksum is placed at the end of the file.
147*b2efd602SCy Schubert# This makes the format more resistant to corruption but there is a performance
148*b2efd602SCy Schubert# hit to pay (around 10%) when saving and loading RDB files, so you can disable it
149*b2efd602SCy Schubert# for maximum performances.
150*b2efd602SCy Schubert#
151*b2efd602SCy Schubert# RDB files created with checksum disabled have a checksum of zero that will
152*b2efd602SCy Schubert# tell the loading code to skip the check.
153*b2efd602SCy Schubertrdbchecksum yes
154*b2efd602SCy Schubert
155*b2efd602SCy Schubert# The filename where to dump the DB
156*b2efd602SCy Schubertdbfilename redis.rdb
157*b2efd602SCy Schubert
158*b2efd602SCy Schubert# Remove RDB files used by replication in instances without persistence
159*b2efd602SCy Schubert# enabled. By default this option is disabled, however there are environments
160*b2efd602SCy Schubert# where for regulations or other security concerns, RDB files persisted on
161*b2efd602SCy Schubert# disk by masters in order to feed replicas, or stored on disk by replicas
162*b2efd602SCy Schubert# in order to load them for the initial synchronization, should be deleted
163*b2efd602SCy Schubert# ASAP. Note that this option ONLY WORKS in instances that have both AOF
164*b2efd602SCy Schubert# and RDB persistence disabled, otherwise is completely ignored.
165*b2efd602SCy Schubert#
166*b2efd602SCy Schubert# An alternative (and sometimes better) way to obtain the same effect is
167*b2efd602SCy Schubert# to use diskless replication on both master and replicas instances. However
168*b2efd602SCy Schubert# in the case of replicas, diskless is not always an option.
169*b2efd602SCy Schubertrdb-del-sync-files no
170*b2efd602SCy Schubert
171*b2efd602SCy Schubert# When a replica loses its connection with the master, or when the replication
172*b2efd602SCy Schubert# is still in progress, the replica can act in two different ways:
173*b2efd602SCy Schubert#
174*b2efd602SCy Schubert# 1) if replica-serve-stale-data is set to 'yes' (the default) the replica will
175*b2efd602SCy Schubert#    still reply to client requests, possibly with out of date data, or the
176*b2efd602SCy Schubert#    data set may just be empty if this is the first synchronization.
177*b2efd602SCy Schubert#
178*b2efd602SCy Schubert# 2) If replica-serve-stale-data is set to 'no' the replica will reply with error
179*b2efd602SCy Schubert#    "MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'"
180*b2efd602SCy Schubert#    to all data access commands, excluding commands such as:
181*b2efd602SCy Schubert#    INFO, REPLICAOF, AUTH, SHUTDOWN, REPLCONF, ROLE, CONFIG, SUBSCRIBE,
182*b2efd602SCy Schubert#    UNSUBSCRIBE, PSUBSCRIBE, PUNSUBSCRIBE, PUBLISH, PUBSUB, COMMAND, POST,
183*b2efd602SCy Schubert#    HOST and LATENCY.
184*b2efd602SCy Schubert#
185*b2efd602SCy Schubertreplica-serve-stale-data yes
186*b2efd602SCy Schubert
187*b2efd602SCy Schubert# You can configure a replica instance to accept writes or not. Writing against
188*b2efd602SCy Schubert# a replica instance may be useful to store some ephemeral data (because data
189*b2efd602SCy Schubert# written on a replica will be easily deleted after resync with the master) but
190*b2efd602SCy Schubert# may also cause problems if clients are writing to it because of a
191*b2efd602SCy Schubert# misconfiguration.
192*b2efd602SCy Schubert#
193*b2efd602SCy Schubert# Since Redis 2.6 by default replicas are read-only.
194*b2efd602SCy Schubert#
195*b2efd602SCy Schubert# Note: read only replicas are not designed to be exposed to untrusted clients
196*b2efd602SCy Schubert# on the internet. It's just a protection layer against misuse of the instance.
197*b2efd602SCy Schubert# Still a read only replica exports by default all the administrative commands
198*b2efd602SCy Schubert# such as CONFIG, DEBUG, and so forth. To a limited extent you can improve
199*b2efd602SCy Schubert# security of read only replicas using 'rename-command' to shadow all the
200*b2efd602SCy Schubert# administrative / dangerous commands.
201*b2efd602SCy Schubertreplica-read-only yes
202*b2efd602SCy Schubert
203*b2efd602SCy Schubert# Replication SYNC strategy: disk or socket.
204*b2efd602SCy Schubert#
205*b2efd602SCy Schubert# New replicas and reconnecting replicas that are not able to continue the
206*b2efd602SCy Schubert# replication process just receiving differences, need to do what is called a
207*b2efd602SCy Schubert# "full synchronization". An RDB file is transmitted from the master to the
208*b2efd602SCy Schubert# replicas.
209*b2efd602SCy Schubert#
210*b2efd602SCy Schubert# The transmission can happen in two different ways:
211*b2efd602SCy Schubert#
212*b2efd602SCy Schubert# 1) Disk-backed: The Redis master creates a new process that writes the RDB
213*b2efd602SCy Schubert#                 file on disk. Later the file is transferred by the parent
214*b2efd602SCy Schubert#                 process to the replicas incrementally.
215*b2efd602SCy Schubert# 2) Diskless: The Redis master creates a new process that directly writes the
216*b2efd602SCy Schubert#              RDB file to replica sockets, without touching the disk at all.
217*b2efd602SCy Schubert#
218*b2efd602SCy Schubert# With disk-backed replication, while the RDB file is generated, more replicas
219*b2efd602SCy Schubert# can be queued and served with the RDB file as soon as the current child
220*b2efd602SCy Schubert# producing the RDB file finishes its work. With diskless replication instead
221*b2efd602SCy Schubert# once the transfer starts, new replicas arriving will be queued and a new
222*b2efd602SCy Schubert# transfer will start when the current one terminates.
223*b2efd602SCy Schubert#
224*b2efd602SCy Schubert# When diskless replication is used, the master waits a configurable amount of
225*b2efd602SCy Schubert# time (in seconds) before starting the transfer in the hope that multiple
226*b2efd602SCy Schubert# replicas will arrive and the transfer can be parallelized.
227*b2efd602SCy Schubert#
228*b2efd602SCy Schubert# With slow disks and fast (large bandwidth) networks, diskless replication
229*b2efd602SCy Schubert# works better.
230*b2efd602SCy Schubertrepl-diskless-sync yes
231*b2efd602SCy Schubert
232*b2efd602SCy Schubert# When diskless replication is enabled, it is possible to configure the delay
233*b2efd602SCy Schubert# the server waits in order to spawn the child that transfers the RDB via socket
234*b2efd602SCy Schubert# to the replicas.
235*b2efd602SCy Schubert#
236*b2efd602SCy Schubert# This is important since once the transfer starts, it is not possible to serve
237*b2efd602SCy Schubert# new replicas arriving, that will be queued for the next RDB transfer, so the
238*b2efd602SCy Schubert# server waits a delay in order to let more replicas arrive.
239*b2efd602SCy Schubert#
240*b2efd602SCy Schubert# The delay is specified in seconds, and by default is 5 seconds. To disable
241*b2efd602SCy Schubert# it entirely just set it to 0 seconds and the transfer will start ASAP.
242*b2efd602SCy Schubertrepl-diskless-sync-delay 5
243*b2efd602SCy Schubert
244*b2efd602SCy Schubert# When diskless replication is enabled with a delay, it is possible to let
245*b2efd602SCy Schubert# the replication start before the maximum delay is reached if the maximum
246*b2efd602SCy Schubert# number of replicas expected have connected. Default of 0 means that the
247*b2efd602SCy Schubert# maximum is not defined and Redis will wait the full delay.
248*b2efd602SCy Schubert#repl-diskless-sync-max-replicas 0
249*b2efd602SCy Schubert
250*b2efd602SCy Schubert# -----------------------------------------------------------------------------
251*b2efd602SCy Schubert# WARNING: Since in this setup the replica does not immediately store an RDB on
252*b2efd602SCy Schubert# disk, it may cause data loss during failovers. RDB diskless load + Redis
253*b2efd602SCy Schubert# modules not handling I/O reads may cause Redis to abort in case of I/O errors
254*b2efd602SCy Schubert# during the initial synchronization stage with the master.
255*b2efd602SCy Schubert# -----------------------------------------------------------------------------
256*b2efd602SCy Schubert#
257*b2efd602SCy Schubert# Replica can load the RDB it reads from the replication link directly from the
258*b2efd602SCy Schubert# socket, or store the RDB to a file and read that file after it was completely
259*b2efd602SCy Schubert# received from the master.
260*b2efd602SCy Schubert#
261*b2efd602SCy Schubert# In many cases the disk is slower than the network, and storing and loading
262*b2efd602SCy Schubert# the RDB file may increase replication time (and even increase the master's
263*b2efd602SCy Schubert# Copy on Write memory and replica buffers).
264*b2efd602SCy Schubert# However, when parsing the RDB file directly from the socket, in order to avoid
265*b2efd602SCy Schubert# data loss it's only safe to flush the current dataset when the new dataset is
266*b2efd602SCy Schubert# fully loaded in memory, resulting in higher memory usage.
267*b2efd602SCy Schubert# For this reason we have the following options:
268*b2efd602SCy Schubert#
269*b2efd602SCy Schubert# "disabled"    - Don't use diskless load (store the rdb file to the disk first)
270*b2efd602SCy Schubert# "swapdb"      - Keep current db contents in RAM while parsing the data directly
271*b2efd602SCy Schubert#                 from the socket. Replicas in this mode can keep serving current
272*b2efd602SCy Schubert#                 dataset while replication is in progress, except for cases where
273*b2efd602SCy Schubert#                 they can't recognize master as having a data set from same
274*b2efd602SCy Schubert#                 replication history.
275*b2efd602SCy Schubert#                 Note that this requires sufficient memory, if you don't have it,
276*b2efd602SCy Schubert#                 you risk an OOM kill.
277*b2efd602SCy Schubert# "on-empty-db" - Use diskless load only when current dataset is empty. This is
278*b2efd602SCy Schubert#                 safer and avoid having old and new dataset loaded side by side
279*b2efd602SCy Schubert#                 during replication.
280*b2efd602SCy Schubertrepl-diskless-load disabled
281*b2efd602SCy Schubert
282*b2efd602SCy Schubert# Master send PINGs to its replicas in a predefined interval. It's possible to
283*b2efd602SCy Schubert# change this interval with the repl_ping_replica_period option. The default
284*b2efd602SCy Schubert# value is 10 seconds.
285*b2efd602SCy Schubert#
286*b2efd602SCy Schubert# repl-ping-replica-period 10
287*b2efd602SCy Schubert
288*b2efd602SCy Schubert# The following option sets the replication timeout for:
289*b2efd602SCy Schubert#
290*b2efd602SCy Schubert# 1) Bulk transfer I/O during SYNC, from the point of view of replica.
291*b2efd602SCy Schubert# 2) Master timeout from the point of view of replicas (data, pings).
292*b2efd602SCy Schubert# 3) Replica timeout from the point of view of masters (REPLCONF ACK pings).
293*b2efd602SCy Schubert#
294*b2efd602SCy Schubert# It is important to make sure that this value is greater than the value
295*b2efd602SCy Schubert# specified for repl-ping-replica-period otherwise a timeout will be detected
296*b2efd602SCy Schubert# every time there is low traffic between the master and the replica. The default
297*b2efd602SCy Schubert# value is 60 seconds.
298*b2efd602SCy Schubert#
299*b2efd602SCy Schubert# repl-timeout 60
300*b2efd602SCy Schubert
301*b2efd602SCy Schubert# Disable TCP_NODELAY on the replica socket after SYNC?
302*b2efd602SCy Schubert#
303*b2efd602SCy Schubert# If you select "yes" Redis will use a smaller number of TCP packets and
304*b2efd602SCy Schubert# less bandwidth to send data to replicas. But this can add a delay for
305*b2efd602SCy Schubert# the data to appear on the replica side, up to 40 milliseconds with
306*b2efd602SCy Schubert# Linux kernels using a default configuration.
307*b2efd602SCy Schubert#
308*b2efd602SCy Schubert# If you select "no" the delay for data to appear on the replica side will
309*b2efd602SCy Schubert# be reduced but more bandwidth will be used for replication.
310*b2efd602SCy Schubert#
311*b2efd602SCy Schubert# By default we optimize for low latency, but in very high traffic conditions
312*b2efd602SCy Schubert# or when the master and replicas are many hops away, turning this to "yes" may
313*b2efd602SCy Schubert# be a good idea.
314*b2efd602SCy Schubertrepl-disable-tcp-nodelay no
315*b2efd602SCy Schubert
316*b2efd602SCy Schubert# The replica priority is an integer number published by Redis in the INFO
317*b2efd602SCy Schubert# output. It is used by Redis Sentinel in order to select a replica to promote
318*b2efd602SCy Schubert# into a master if the master is no longer working correctly.
319*b2efd602SCy Schubert#
320*b2efd602SCy Schubert# A replica with a low priority number is considered better for promotion, so
321*b2efd602SCy Schubert# for instance if there are three replicas with priority 10, 100, 25 Sentinel
322*b2efd602SCy Schubert# will pick the one with priority 10, that is the lowest.
323*b2efd602SCy Schubert#
324*b2efd602SCy Schubert# However a special priority of 0 marks the replica as not able to perform the
325*b2efd602SCy Schubert# role of master, so a replica with priority of 0 will never be selected by
326*b2efd602SCy Schubert# Redis Sentinel for promotion.
327*b2efd602SCy Schubert#
328*b2efd602SCy Schubert# By default the priority is 100.
329*b2efd602SCy Schubertreplica-priority 100
330*b2efd602SCy Schubert
331*b2efd602SCy Schubert# ACL LOG
332*b2efd602SCy Schubert#
333*b2efd602SCy Schubert# The ACL Log tracks failed commands and authentication events associated
334*b2efd602SCy Schubert# with ACLs. The ACL Log is useful to troubleshoot failed commands blocked
335*b2efd602SCy Schubert# by ACLs. The ACL Log is stored in memory. You can reclaim memory with
336*b2efd602SCy Schubert# ACL LOG RESET. Define the maximum entry length of the ACL Log below.
337*b2efd602SCy Schubertacllog-max-len 128
338*b2efd602SCy Schubert
339*b2efd602SCy Schubertlazyfree-lazy-eviction no
340*b2efd602SCy Schubertlazyfree-lazy-expire no
341*b2efd602SCy Schubertlazyfree-lazy-server-del no
342*b2efd602SCy Schubertreplica-lazy-flush no
343*b2efd602SCy Schubert
344*b2efd602SCy Schubert# It is also possible, for the case when to replace the user code DEL calls
345*b2efd602SCy Schubert# with UNLINK calls is not easy, to modify the default behavior of the DEL
346*b2efd602SCy Schubert# command to act exactly like UNLINK, using the following configuration
347*b2efd602SCy Schubert# directive:
348*b2efd602SCy Schubertlazyfree-lazy-user-del no
349*b2efd602SCy Schubert
350*b2efd602SCy Schubert# FLUSHDB, FLUSHALL, SCRIPT FLUSH and FUNCTION FLUSH support both asynchronous and synchronous
351*b2efd602SCy Schubert# deletion, which can be controlled by passing the [SYNC|ASYNC] flags into the
352*b2efd602SCy Schubert# commands. When neither flag is passed, this directive will be used to determine
353*b2efd602SCy Schubert# if the data should be deleted asynchronously.
354*b2efd602SCy Schubertlazyfree-lazy-user-flush no
355*b2efd602SCy Schubert
356*b2efd602SCy Schubert# On Linux, it is possible to hint the kernel OOM killer on what processes
357*b2efd602SCy Schubert# should be killed first when out of memory.
358*b2efd602SCy Schubert#
359*b2efd602SCy Schubert# Enabling this feature makes Redis actively control the oom_score_adj value
360*b2efd602SCy Schubert# for all its processes, depending on their role. The default scores will
361*b2efd602SCy Schubert# attempt to have background child processes killed before all others, and
362*b2efd602SCy Schubert# replicas killed before masters.
363*b2efd602SCy Schubert#
364*b2efd602SCy Schubert# Redis supports these options:
365*b2efd602SCy Schubert#
366*b2efd602SCy Schubert# no:       Don't make changes to oom-score-adj (default).
367*b2efd602SCy Schubert# yes:      Alias to "relative" see below.
368*b2efd602SCy Schubert# absolute: Values in oom-score-adj-values are written as is to the kernel.
369*b2efd602SCy Schubert# relative: Values are used relative to the initial value of oom_score_adj when
370*b2efd602SCy Schubert#           the server starts and are then clamped to a range of -1000 to 1000.
371*b2efd602SCy Schubert#           Because typically the initial value is 0, they will often match the
372*b2efd602SCy Schubert#           absolute values.
373*b2efd602SCy Schubertoom-score-adj no
374*b2efd602SCy Schubert
375*b2efd602SCy Schubert# When oom-score-adj is used, this directive controls the specific values used
376*b2efd602SCy Schubert# for master, replica and background child processes. Values range -2000 to
377*b2efd602SCy Schubert# 2000 (higher means more likely to be killed).
378*b2efd602SCy Schubert#
379*b2efd602SCy Schubert# Unprivileged processes (not root, and without CAP_SYS_RESOURCE capabilities)
380*b2efd602SCy Schubert# can freely increase their value, but not decrease it below its initial
381*b2efd602SCy Schubert# settings. This means that setting oom-score-adj to "relative" and setting the
382*b2efd602SCy Schubert# oom-score-adj-values to positive values will always succeed.
383*b2efd602SCy Schubertoom-score-adj-values 0 200 800
384*b2efd602SCy Schubert
385*b2efd602SCy Schubert# Usually the kernel Transparent Huge Pages control is set to "madvise" or
386*b2efd602SCy Schubert# or "never" by default (/sys/kernel/mm/transparent_hugepage/enabled), in which
387*b2efd602SCy Schubert# case this config has no effect. On systems in which it is set to "always",
388*b2efd602SCy Schubert# redis will attempt to disable it specifically for the redis process in order
389*b2efd602SCy Schubert# to avoid latency problems specifically with fork(2) and CoW.
390*b2efd602SCy Schubert# If for some reason you prefer to keep it enabled, you can set this config to
391*b2efd602SCy Schubert# "no" and the kernel global to "always".
392*b2efd602SCy Schubertdisable-thp yes
393*b2efd602SCy Schubert
394*b2efd602SCy Schubert# By default Redis asynchronously dumps the dataset on disk. This mode is
395*b2efd602SCy Schubert# good enough in many applications, but an issue with the Redis process or
396*b2efd602SCy Schubert# a power outage may result into a few minutes of writes lost (depending on
397*b2efd602SCy Schubert# the configured save points).
398*b2efd602SCy Schubert#
399*b2efd602SCy Schubert# The Append Only File is an alternative persistence mode that provides
400*b2efd602SCy Schubert# much better durability. For instance using the default data fsync policy
401*b2efd602SCy Schubert# (see later in the config file) Redis can lose just one second of writes in a
402*b2efd602SCy Schubert# dramatic event like a server power outage, or a single write if something
403*b2efd602SCy Schubert# wrong with the Redis process itself happens, but the operating system is
404*b2efd602SCy Schubert# still running correctly.
405*b2efd602SCy Schubert#
406*b2efd602SCy Schubert# AOF and RDB persistence can be enabled at the same time without problems.
407*b2efd602SCy Schubert# If the AOF is enabled on startup Redis will load the AOF, that is the file
408*b2efd602SCy Schubert# with the better durability guarantees.
409*b2efd602SCy Schubert#
410*b2efd602SCy Schubert# Please check https://redis.io/topics/persistence for more information.
411*b2efd602SCy Schubertappendonly no
412*b2efd602SCy Schubert
413*b2efd602SCy Schubert# The following time is expressed in microseconds, so 1000000 is equivalent
414*b2efd602SCy Schubert# to one second. Note that a negative number disables the slow log, while
415*b2efd602SCy Schubert# a value of zero forces the logging of every command.
416*b2efd602SCy Schubertslowlog-log-slower-than 10000
417*b2efd602SCy Schubert
418*b2efd602SCy Schubert# There is no limit to this length. Just be aware that it will consume memory.
419*b2efd602SCy Schubert# You can reclaim memory used by the slow log with SLOWLOG RESET.
420*b2efd602SCy Schubertslowlog-max-len 128
421*b2efd602SCy Schubert
422*b2efd602SCy Schubert# By default latency monitoring is disabled since it is mostly not needed
423*b2efd602SCy Schubert# if you don't have latency issues, and collecting data has a performance
424*b2efd602SCy Schubert# impact, that while very small, can be measured under big load. Latency
425*b2efd602SCy Schubert# monitoring can easily be enabled at runtime using the command
426*b2efd602SCy Schubert# "CONFIG SET latency-monitor-threshold <milliseconds>" if needed.
427*b2efd602SCy Schubertlatency-monitor-threshold 0
428*b2efd602SCy Schubert
429*b2efd602SCy Schubert#  By default all notifications are disabled because most users don't need
430*b2efd602SCy Schubert#  this feature and the feature has some overhead. Note that if you don't
431*b2efd602SCy Schubert#  specify at least one of K or E, no events will be delivered.
432*b2efd602SCy Schubertnotify-keyspace-events ""
433*b2efd602SCy Schubert
434*b2efd602SCy Schubert# Hashes are encoded using a memory efficient data structure when they have a
435*b2efd602SCy Schubert# small number of entries, and the biggest entry does not exceed a given
436*b2efd602SCy Schubert# threshold. These thresholds can be configured using the following directives.
437*b2efd602SCy Schubert#hash-max-listpack-entries 512
438*b2efd602SCy Schubert#hash-max-listpack-value 64
439*b2efd602SCy Schubert
440*b2efd602SCy Schubert# Lists are also encoded in a special way to save a lot of space.
441*b2efd602SCy Schubert# The number of entries allowed per internal list node can be specified
442*b2efd602SCy Schubert# as a fixed maximum size or a maximum number of elements.
443*b2efd602SCy Schubert# For a fixed maximum size, use -5 through -1, meaning:
444*b2efd602SCy Schubert# -5: max size: 64 Kb  <-- not recommended for normal workloads
445*b2efd602SCy Schubert# -4: max size: 32 Kb  <-- not recommended
446*b2efd602SCy Schubert# -3: max size: 16 Kb  <-- probably not recommended
447*b2efd602SCy Schubert# -2: max size: 8 Kb   <-- good
448*b2efd602SCy Schubert# -1: max size: 4 Kb   <-- good
449*b2efd602SCy Schubert# Positive numbers mean store up to _exactly_ that number of elements
450*b2efd602SCy Schubert# per list node.
451*b2efd602SCy Schubert# The highest performing option is usually -2 (8 Kb size) or -1 (4 Kb size),
452*b2efd602SCy Schubert# but if your use case is unique, adjust the settings as necessary.
453*b2efd602SCy Schubert#list-max-listpack-size -2
454*b2efd602SCy Schubert
455*b2efd602SCy Schubert# Lists may also be compressed.
456*b2efd602SCy Schubert# Compress depth is the number of quicklist ziplist nodes from *each* side of
457*b2efd602SCy Schubert# the list to *exclude* from compression.  The head and tail of the list
458*b2efd602SCy Schubert# are always uncompressed for fast push/pop operations.  Settings are:
459*b2efd602SCy Schubert# 0: disable all list compression
460*b2efd602SCy Schubert# 1: depth 1 means "don't start compressing until after 1 node into the list,
461*b2efd602SCy Schubert#    going from either the head or tail"
462*b2efd602SCy Schubert#    So: [head]->node->node->...->node->[tail]
463*b2efd602SCy Schubert#    [head], [tail] will always be uncompressed; inner nodes will compress.
464*b2efd602SCy Schubert# 2: [head]->[next]->node->node->...->node->[prev]->[tail]
465*b2efd602SCy Schubert#    2 here means: don't compress head or head->next or tail->prev or tail,
466*b2efd602SCy Schubert#    but compress all nodes between them.
467*b2efd602SCy Schubert# 3: [head]->[next]->[next]->node->node->...->node->[prev]->[prev]->[tail]
468*b2efd602SCy Schubert# etc.
469*b2efd602SCy Schubertlist-compress-depth 0
470*b2efd602SCy Schubert
471*b2efd602SCy Schubert# Sets have a special encoding when a set is composed
472*b2efd602SCy Schubert# of just strings that happen to be integers in radix 10 in the range
473*b2efd602SCy Schubert# of 64 bit signed integers.
474*b2efd602SCy Schubert# The following configuration setting sets the limit in the size of the
475*b2efd602SCy Schubert# set in order to use this special memory saving encoding.
476*b2efd602SCy Schubertset-max-intset-entries 512
477*b2efd602SCy Schubert
478*b2efd602SCy Schubert# Sets containing non-integer values are also encoded using a memory efficient
479*b2efd602SCy Schubert# data structure when they have a small number of entries, and the biggest entry
480*b2efd602SCy Schubert# does not exceed a given threshold. These thresholds can be configured using
481*b2efd602SCy Schubert# the following directives.
482*b2efd602SCy Schubert#set-max-listpack-entries 128
483*b2efd602SCy Schubert#set-max-listpack-value 64
484*b2efd602SCy Schubert
485*b2efd602SCy Schubert# Similarly to hashes and lists, sorted sets are also specially encoded in
486*b2efd602SCy Schubert# order to save a lot of space. This encoding is only used when the length and
487*b2efd602SCy Schubert# elements of a sorted set are below the following limits:
488*b2efd602SCy Schubert#zset-max-listpack-entries 128
489*b2efd602SCy Schubert#zset-max-listpack-value 64
490*b2efd602SCy Schubert
491*b2efd602SCy Schubert# HyperLogLog sparse representation bytes limit. The limit includes the
492*b2efd602SCy Schubert# 16 bytes header. When a HyperLogLog using the sparse representation crosses
493*b2efd602SCy Schubert# this limit, it is converted into the dense representation.
494*b2efd602SCy Schubert#
495*b2efd602SCy Schubert# A value greater than 16000 is totally useless, since at that point the
496*b2efd602SCy Schubert# dense representation is more memory efficient.
497*b2efd602SCy Schubert#
498*b2efd602SCy Schubert# The suggested value is ~ 3000 in order to have the benefits of
499*b2efd602SCy Schubert# the space efficient encoding without slowing down too much PFADD,
500*b2efd602SCy Schubert# which is O(N) with the sparse encoding. The value can be raised to
501*b2efd602SCy Schubert# ~ 10000 when CPU is not a concern, but space is, and the data set is
502*b2efd602SCy Schubert# composed of many HyperLogLogs with cardinality in the 0 - 15000 range.
503*b2efd602SCy Schuberthll-sparse-max-bytes 3000
504*b2efd602SCy Schubert
505*b2efd602SCy Schubert# Streams macro node max size / items. The stream data structure is a radix
506*b2efd602SCy Schubert# tree of big nodes that encode multiple items inside. Using this configuration
507*b2efd602SCy Schubert# it is possible to configure how big a single node can be in bytes, and the
508*b2efd602SCy Schubert# maximum number of items it may contain before switching to a new node when
509*b2efd602SCy Schubert# appending new stream entries. If any of the following settings are set to
510*b2efd602SCy Schubert# zero, the limit is ignored, so for instance it is possible to set just a
511*b2efd602SCy Schubert# max entries limit by setting max-bytes to 0 and max-entries to the desired
512*b2efd602SCy Schubert# value.
513*b2efd602SCy Schubertstream-node-max-bytes 4096
514*b2efd602SCy Schubertstream-node-max-entries 100
515*b2efd602SCy Schubert
516*b2efd602SCy Schubert# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
517*b2efd602SCy Schubert# order to help rehashing the main Redis hash table (the one mapping top-level
518*b2efd602SCy Schubert# keys to values). The hash table implementation Redis uses (see dict.c)
519*b2efd602SCy Schubert# performs a lazy rehashing: the more operation you run into a hash table
520*b2efd602SCy Schubert# that is rehashing, the more rehashing "steps" are performed, so if the
521*b2efd602SCy Schubert# server is idle the rehashing is never complete and some more memory is used
522*b2efd602SCy Schubert# by the hash table.
523*b2efd602SCy Schubert#
524*b2efd602SCy Schubert# The default is to use this millisecond 10 times every second in order to
525*b2efd602SCy Schubert# actively rehash the main dictionaries, freeing memory when possible.
526*b2efd602SCy Schubert#
527*b2efd602SCy Schubert# If unsure:
528*b2efd602SCy Schubert# use "activerehashing no" if you have hard latency requirements and it is
529*b2efd602SCy Schubert# not a good thing in your environment that Redis can reply from time to time
530*b2efd602SCy Schubert# to queries with 2 milliseconds delay.
531*b2efd602SCy Schubert#
532*b2efd602SCy Schubert# use "activerehashing yes" if you don't have such hard requirements but
533*b2efd602SCy Schubert# want to free memory asap when possible.
534*b2efd602SCy Schubertactiverehashing yes
535*b2efd602SCy Schubert
536*b2efd602SCy Schubert# The client output buffer limits can be used to force disconnection of clients
537*b2efd602SCy Schubert# that are not reading data from the server fast enough for some reason (a
538*b2efd602SCy Schubert# common reason is that a Pub/Sub client can't consume messages as fast as the
539*b2efd602SCy Schubert# publisher can produce them).
540*b2efd602SCy Schubert#
541*b2efd602SCy Schubert# Both the hard or the soft limit can be disabled by setting them to zero.
542*b2efd602SCy Schubertclient-output-buffer-limit normal 0 0 0
543*b2efd602SCy Schubertclient-output-buffer-limit replica 256mb 64mb 60
544*b2efd602SCy Schubertclient-output-buffer-limit pubsub 32mb 8mb 60
545*b2efd602SCy Schubert
546*b2efd602SCy Schubert# Redis calls an internal function to perform many background tasks, like
547*b2efd602SCy Schubert# closing connections of clients in timeout, purging expired keys that are
548*b2efd602SCy Schubert# never requested, and so forth.
549*b2efd602SCy Schubert#
550*b2efd602SCy Schubert# Not all tasks are performed with the same frequency, but Redis checks for
551*b2efd602SCy Schubert# tasks to perform according to the specified "hz" value.
552*b2efd602SCy Schubert#
553*b2efd602SCy Schubert# By default "hz" is set to 10. Raising the value will use more CPU when
554*b2efd602SCy Schubert# Redis is idle, but at the same time will make Redis more responsive when
555*b2efd602SCy Schubert# there are many keys expiring at the same time, and timeouts may be
556*b2efd602SCy Schubert# handled with more precision.
557*b2efd602SCy Schubert#
558*b2efd602SCy Schubert# The range is between 1 and 500, however a value over 100 is usually not
559*b2efd602SCy Schubert# a good idea. Most users should use the default of 10 and raise this up to
560*b2efd602SCy Schubert# 100 only in environments where very low latency is required.
561*b2efd602SCy Schuberthz 10
562*b2efd602SCy Schubert
563*b2efd602SCy Schubert# When dynamic HZ is enabled, the actual configured HZ will be used
564*b2efd602SCy Schubert# as a baseline, but multiples of the configured HZ value will be actually
565*b2efd602SCy Schubert# used as needed once more clients are connected. In this way an idle
566*b2efd602SCy Schubert# instance will use very little CPU time while a busy instance will be
567*b2efd602SCy Schubert# more responsive.
568*b2efd602SCy Schubertdynamic-hz yes
569*b2efd602SCy Schubert
570*b2efd602SCy Schubert# When a child rewrites the AOF file, if the following option is enabled
571*b2efd602SCy Schubert# the file will be fsync-ed every 4 MB of data generated. This is useful
572*b2efd602SCy Schubert# in order to commit the file to the disk more incrementally and avoid
573*b2efd602SCy Schubert# big latency spikes.
574*b2efd602SCy Schubertaof-rewrite-incremental-fsync yes
575*b2efd602SCy Schubert
576*b2efd602SCy Schubert# When redis saves RDB file, if the following option is enabled
577*b2efd602SCy Schubert# the file will be fsync-ed every 4 MB of data generated. This is useful
578*b2efd602SCy Schubert# in order to commit the file to the disk more incrementally and avoid
579*b2efd602SCy Schubert# big latency spikes.
580*b2efd602SCy Schubertrdb-save-incremental-fsync yes
581*b2efd602SCy Schubert
582*b2efd602SCy Schubert# Jemalloc background thread for purging will be enabled by default
583*b2efd602SCy Schubertjemalloc-bg-thread yes
584