redis.conf 105 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297
  1. # 下载地址: http://download.redis.io/redis-stable/redis.conf
  2. # https://github.com/redis/redis/blob/7.2/redis.conf
  3. # Redis configuration file example.
  4. #
  5. # Note that in order to read the configuration file, Redis must be
  6. # started with the file path as first argument:
  7. #
  8. # ./redis-server /path/to/redis.conf
  9. # Note on units: when memory size is needed, it is possible to specify
  10. # it in the usual form of 1k 5GB 4M and so forth:
  11. #
  12. # 1k => 1000 bytes
  13. # 1kb => 1024 bytes
  14. # 1m => 1000000 bytes
  15. # 1mb => 1024*1024 bytes
  16. # 1g => 1000000000 bytes
  17. # 1gb => 1024*1024*1024 bytes
  18. #
  19. # units are case insensitive so 1GB 1Gb 1gB are all the same.
  20. ################################## INCLUDES ###################################
  21. # Include one or more other config files here. This is useful if you
  22. # have a standard template that goes to all Redis servers but also need
  23. # to customize a few per-server settings. Include files can include
  24. # other files, so use this wisely.
  25. #
  26. # Note that option "include" won't be rewritten by command "CONFIG REWRITE"
  27. # from admin or Redis Sentinel. Since Redis always uses the last processed
  28. # line as value of a configuration directive, you'd better put includes
  29. # at the beginning of this file to avoid overwriting config change at runtime.
  30. #
  31. # If instead you are interested in using includes to override configuration
  32. # options, it is better to use include as the last line.
  33. #
  34. # Included paths may contain wildcards. All files matching the wildcards will
  35. # be included in alphabetical order.
  36. # Note that if an include path contains a wildcards but no files match it when
  37. # the server is started, the include statement will be ignored and no error will
  38. # be emitted. It is safe, therefore, to include wildcard files from empty
  39. # directories.
  40. #
  41. # include /path/to/local.conf
  42. # include /path/to/other.conf
  43. # include /path/to/fragments/*.conf
  44. #
  45. ################################## MODULES #####################################
  46. # Load modules at startup. If the server is not able to load modules
  47. # it will abort. It is possible to use multiple loadmodule directives.
  48. #
  49. # loadmodule /path/to/my_module.so
  50. # loadmodule /path/to/other_module.so
  51. ################################## NETWORK #####################################
  52. # By default, if no "bind" configuration directive is specified, Redis listens
  53. # for connections from all available network interfaces on the host machine.
  54. # It is possible to listen to just one or multiple selected interfaces using
  55. # the "bind" configuration directive, followed by one or more IP addresses.
  56. # Each address can be prefixed by "-", which means that redis will not fail to
  57. # start if the address is not available. Being not available only refers to
  58. # addresses that does not correspond to any network interface. Addresses that
  59. # are already in use will always fail, and unsupported protocols will always BE
  60. # silently skipped.
  61. #
  62. # Examples:
  63. #
  64. # bind 192.168.1.100 10.0.0.1 # listens on two specific IPv4 addresses
  65. # bind 127.0.0.1 ::1 # listens on loopback IPv4 and IPv6
  66. # bind * -::* # like the default, all available interfaces
  67. #
  68. # ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
  69. # internet, binding to all the interfaces is dangerous and will expose the
  70. # instance to everybody on the internet. So by default we uncomment the
  71. # following bind directive, that will force Redis to listen only on the
  72. # IPv4 and IPv6 (if available) loopback interface addresses (this means Redis
  73. # will only be able to accept client connections from the same host that it is
  74. # running on).
  75. #
  76. # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
  77. # COMMENT OUT THE FOLLOWING LINE.
  78. #
  79. # You will also need to set a password unless you explicitly disable protected
  80. # mode.
  81. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  82. #bind 127.0.0.1 -::1
  83. # By default, outgoing connections (from replica to master, from Sentinel to
  84. # instances, cluster bus, etc.) are not bound to a specific local address. In
  85. # most cases, this means the operating system will handle that based on routing
  86. # and the interface through which the connection goes out.
  87. #
  88. # Using bind-source-addr it is possible to configure a specific address to bind
  89. # to, which may also affect how the connection gets routed.
  90. #
  91. # Example:
  92. #
  93. # bind-source-addr 10.0.0.1
  94. # Protected mode is a layer of security protection, in order to avoid that
  95. # Redis instances left open on the internet are accessed and exploited.
  96. #
  97. # When protected mode is on and the default user has no password, the server
  98. # only accepts local connections from the IPv4 address (127.0.0.1), IPv6 address
  99. # (::1) or Unix domain sockets.
  100. #
  101. # By default protected mode is enabled. You should disable it only if
  102. # you are sure you want clients from other hosts to connect to Redis
  103. # even if no authentication is configured.
  104. protected-mode no
  105. # Redis uses default hardened security configuration directives to reduce the
  106. # attack surface on innocent users. Therefore, several sensitive configuration
  107. # directives are immutable, and some potentially-dangerous commands are blocked.
  108. #
  109. # Configuration directives that control files that Redis writes to (e.g., 'dir'
  110. # and 'dbfilename') and that aren't usually modified during runtime
  111. # are protected by making them immutable.
  112. #
  113. # Commands that can increase the attack surface of Redis and that aren't usually
  114. # called by users are blocked by default.
  115. #
  116. # These can be exposed to either all connections or just local ones by setting
  117. # each of the configs listed below to either of these values:
  118. #
  119. # no - Block for any connection (remain immutable)
  120. # yes - Allow for any connection (no protection)
  121. # local - Allow only for local connections. Ones originating from the
  122. # IPv4 address (127.0.0.1), IPv6 address (::1) or Unix domain sockets.
  123. #
  124. # enable-protected-configs no
  125. # enable-debug-command no
  126. # enable-business-command no
  127. # Accept connections on the specified port, default is 6379 (IANA #815344).
  128. # If port 0 is specified Redis will not listen on a TCP socket.
  129. port 6379
  130. # TCP listen() backlog.
  131. #
  132. # In high requests-per-second environments you need a high backlog in order
  133. # to avoid slow clients connection issues. Note that the Linux kernel
  134. # will silently truncate it to the value of /proc/sys/net/core/somaxconn so
  135. # make sure to raise both the value of somaxconn and tcp_max_syn_backlog
  136. # in order to get the desired effect.
  137. tcp-backlog 511
  138. # Unix socket.
  139. #
  140. # Specify the path for the Unix socket that will be used to listen for
  141. # incoming connections. There is no default, so Redis will not listen
  142. # on a unix socket when not specified.
  143. #
  144. # unixsocket /run/redis.sock
  145. # unixsocketperm 700
  146. # Close the connection after a client is idle for N seconds (0 to disable)
  147. timeout 0
  148. # TCP keepalive.
  149. #
  150. # If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence
  151. # of communication. This is useful for two reasons:
  152. #
  153. # 1) Detect dead peers.
  154. # 2) Force network equipment in the middle to consider the connection to be
  155. # alive.
  156. #
  157. # On Linux, the specified value (in seconds) is the period used to send ACKs.
  158. # Note that to close the connection the double of the time is needed.
  159. # On other kernels the period depends on the kernel configuration.
  160. #
  161. # A reasonable value for this option is 300 seconds, which is the new
  162. # Redis default starting with Redis 3.2.1.
  163. tcp-keepalive 300
  164. # Apply OS-specific mechanism to mark the listening socket with the specified
  165. # ID, to support advanced routing and filtering capabilities.
  166. #
  167. # On Linux, the ID represents a connection mark.
  168. # On FreeBSD, the ID represents a socket cookie ID.
  169. # On OpenBSD, the ID represents a route table ID.
  170. #
  171. # The default value is 0, which implies no marking is required.
  172. # socket-mark-id 0
  173. ################################# TLS/SSL #####################################
  174. # By default, TLS/SSL is disabled. To enable it, the "tls-port" configuration
  175. # directive can be used to define TLS-listening ports. To enable TLS on the
  176. # default port, use:
  177. #
  178. # port 0
  179. # tls-port 6379
  180. # Configure a X.509 certificate and private key to use for authenticating the
  181. # server to connected clients, masters or cluster peers. These files should be
  182. # PEM formatted.
  183. #
  184. # tls-cert-file redis.crt
  185. # tls-key-file redis.key
  186. #
  187. # If the key file is encrypted using a passphrase, it can be included here
  188. # as well.
  189. #
  190. # tls-key-file-pass secret
  191. # Normally Redis uses the same certificate for both server functions (accepting
  192. # connections) and client functions (replicating from a master, establishing
  193. # cluster bus connections, etc.).
  194. #
  195. # Sometimes certificates are issued with attributes that designate them as
  196. # client-only or server-only certificates. In that case it may be desired to use
  197. # different certificates for incoming (server) and outgoing (client)
  198. # connections. To do that, use the following directives:
  199. #
  200. # tls-client-cert-file client.crt
  201. # tls-client-key-file client.key
  202. #
  203. # If the key file is encrypted using a passphrase, it can be included here
  204. # as well.
  205. #
  206. # tls-client-key-file-pass secret
  207. # Configure a DH parameters file to enable Diffie-Hellman (DH) key exchange,
  208. # required by older versions of OpenSSL (<3.0). Newer versions do not require
  209. # this configuration and recommend against it.
  210. #
  211. # tls-dh-params-file redis.dh
  212. # Configure a CA certificate(s) bundle or directory to authenticate TLS/SSL
  213. # clients and peers. Redis requires an explicit configuration of at least one
  214. # of these, and will not implicitly use the system wide configuration.
  215. #
  216. # tls-ca-cert-file ca.crt
  217. # tls-ca-cert-dir /etc/ssl/certs
  218. # By default, clients (including replica servers) on a TLS port are required
  219. # to authenticate using valid client side certificates.
  220. #
  221. # If "no" is specified, client certificates are not required and not accepted.
  222. # If "optional" is specified, client certificates are accepted and must be
  223. # valid if provided, but are not required.
  224. #
  225. # tls-auth-clients no
  226. # tls-auth-clients optional
  227. # By default, a Redis replica does not attempt to establish a TLS connection
  228. # with its master.
  229. #
  230. # Use the following directive to enable TLS on replication links.
  231. #
  232. # tls-replication yes
  233. # By default, the Redis Cluster bus uses a plain TCP connection. To enable
  234. # TLS for the bus protocol, use the following directive:
  235. #
  236. # tls-cluster yes
  237. # By default, only TLSv1.2 and TLSv1.3 are enabled and it is highly recommended
  238. # that older formally deprecated versions are kept disabled to reduce the attack surface.
  239. # You can explicitly specify TLS versions to support.
  240. # Allowed values are case insensitive and include "TLSv1", "TLSv1.1", "TLSv1.2",
  241. # "TLSv1.3" (OpenSSL >= 1.1.1) or any combination.
  242. # To enable only TLSv1.2 and TLSv1.3, use:
  243. #
  244. # tls-protocols "TLSv1.2 TLSv1.3"
  245. # Configure allowed ciphers. See the ciphers(1ssl) manpage for more information
  246. # about the syntax of this string.
  247. #
  248. # Note: this configuration applies only to <= TLSv1.2.
  249. #
  250. # tls-ciphers DEFAULT:!MEDIUM
  251. # Configure allowed TLSv1.3 ciphersuites. See the ciphers(1ssl) manpage for more
  252. # information about the syntax of this string, and specifically for TLSv1.3
  253. # ciphersuites.
  254. #
  255. # tls-ciphersuites TLS_CHACHA20_POLY1305_SHA256
  256. # When choosing a cipher, use the server's preference instead of the client
  257. # preference. By default, the server follows the client's preference.
  258. #
  259. # tls-prefer-server-ciphers yes
  260. # By default, TLS session caching is enabled to allow faster and less expensive
  261. # reconnections by clients that support it. Use the following directive to disable
  262. # caching.
  263. #
  264. # tls-session-caching no
  265. # Change the default number of TLS sessions cached. A zero value sets the cache
  266. # to unlimited size. The default size is 20480.
  267. #
  268. # tls-session-cache-size 5000
  269. # Change the default timeout of cached TLS sessions. The default timeout is 300
  270. # seconds.
  271. #
  272. # tls-session-cache-timeout 60
  273. ################################# GENERAL #####################################
  274. # By default Redis does not run as a daemon. Use 'yes' if you need it.
  275. # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
  276. # When Redis is supervised by upstart or systemd, this parameter has no impact.
  277. daemonize no
  278. # If you run Redis from upstart or systemd, Redis can interact with your
  279. # supervision tree. Options:
  280. # supervised no - no supervision interaction
  281. # supervised upstart - signal upstart by putting Redis into SIGSTOP mode
  282. # requires "expect stop" in your upstart job config
  283. # supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
  284. # on startup, and updating Redis status on a regular
  285. # basis.
  286. # supervised auto - detect upstart or systemd method based on
  287. # UPSTART_JOB or NOTIFY_SOCKET environment variables
  288. # Note: these supervision methods only signal "process is ready."
  289. # They do not enable continuous pings back to your supervisor.
  290. #
  291. # The default is "no". To run under upstart/systemd, you can simply uncomment
  292. # the line below:
  293. #
  294. # supervised auto
  295. # If a pid file is specified, Redis writes it where specified at startup
  296. # and removes it at exit.
  297. #
  298. # When the server runs non daemonized, no pid file is created if none is
  299. # specified in the configuration. When the server is daemonized, the pid file
  300. # is used even if not specified, defaulting to "/var/run/redis.pid".
  301. #
  302. # Creating a pid file is best effort: if Redis is not able to create it
  303. # nothing bad happens, the server will start and run normally.
  304. #
  305. # Note that on modern Linux systems "/run/redis.pid" is more conforming
  306. # and should be used instead.
  307. pidfile /var/run/redis_6379.pid
  308. # Specify the server verbosity level.
  309. # This can be one of:
  310. # debug (a lot of information, useful for development/testing)
  311. # verbose (many rarely useful info, but not a mess like the debug level)
  312. # notice (moderately verbose, what you want in production probably)
  313. # warning (only very important / critical messages are logged)
  314. # nothing (nothing is logged)
  315. loglevel notice
  316. # Specify the log file name. Also the empty string can be used to force
  317. # Redis to log on the standard output. Note that if you use standard
  318. # output for logging but daemonize, logs will be sent to /dev/null
  319. logfile ""
  320. # To enable logging to the system logger, just set 'syslog-enabled' to yes,
  321. # and optionally update the other syslog parameters to suit your needs.
  322. # syslog-enabled no
  323. # Specify the syslog identity.
  324. # syslog-ident redis
  325. # Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
  326. # syslog-facility local0
  327. # To disable the built in crash log, which will possibly produce cleaner core
  328. # dumps when they are needed, uncomment the following:
  329. #
  330. # crash-log-enabled no
  331. # To disable the fast memory check that's run as part of the crash log, which
  332. # will possibly let redis terminate sooner, uncomment the following:
  333. #
  334. # crash-memcheck-enabled no
  335. # Set the number of databases. The default database is DB 0, you can select
  336. # a different one on a per-connection basis using SELECT <dbid> where
  337. # dbid is a number between 0 and 'databases'-1
  338. databases 16
  339. # By default Redis shows an ASCII art logo only when started to log to the
  340. # standard output and if the standard output is a TTY and syslog logging is
  341. # disabled. Basically this means that normally a logo is displayed only in
  342. # interactive sessions.
  343. #
  344. # However it is possible to force the pre-4.0 behavior and always show a
  345. # ASCII art logo in startup logs by setting the following option to yes.
  346. always-show-logo no
  347. # By default, Redis modifies the process title (as seen in 'top' and 'ps') to
  348. # provide some runtime information. It is possible to disable this and leave
  349. # the process name as executed by setting the following to no.
  350. set-proc-title yes
  351. # When changing the process title, Redis uses the following template to construct
  352. # the modified title.
  353. #
  354. # Template variables are specified in curly brackets. The following variables are
  355. # supported:
  356. #
  357. # {title} Name of process as executed if parent, or type of child process.
  358. # {listen-addr} Bind address or '*' followed by TCP or TLS port listening on, or
  359. # Unix socket if only that's available.
  360. # {server-mode} Special mode, i.e. "[sentinel]" or "[cluster]".
  361. # {port} TCP port listening on, or 0.
  362. # {tls-port} TLS port listening on, or 0.
  363. # {unixsocket} Unix domain socket listening on, or "".
  364. # {config-file} Name of configuration file used.
  365. #
  366. proc-title-template "{title} {listen-addr} {server-mode}"
  367. # Set the local environment which is used for string comparison operations, and
  368. # also affect the performance of Lua scripts. Empty String indicates the locale
  369. # is derived from the environment variables.
  370. locale-collate ""
  371. ################################ SNAPSHOTTING ################################
  372. # Save the DB to disk.
  373. #
  374. # save <seconds> <changes> [<seconds> <changes> ...]
  375. #
  376. # Redis will save the DB if the given number of seconds elapsed and it
  377. # surpassed the given number of write operations against the DB.
  378. #
  379. # Snapshotting can be completely disabled with a single empty string argument
  380. # as in following example:
  381. #
  382. # save ""
  383. #
  384. # Unless specified otherwise, by default Redis will save the DB:
  385. # * After 3600 seconds (an hour) if at least 1 change was performed
  386. # * After 300 seconds (5 minutes) if at least 100 changes were performed
  387. # * After 60 seconds if at least 10000 changes were performed
  388. #
  389. # You can set these explicitly by uncommenting the following line.
  390. #
  391. # save 3600 1 300 100 60 10000
  392. # By default Redis will stop accepting writes if RDB snapshots are enabled
  393. # (at least one save point) and the latest background save failed.
  394. # This will make the user aware (in a hard way) that data is not persisting
  395. # on disk properly, otherwise chances are that no one will notice and some
  396. # disaster will happen.
  397. #
  398. # If the background saving process will start working again Redis will
  399. # automatically allow writes again.
  400. #
  401. # However if you have setup your proper monitoring of the Redis server
  402. # and persistence, you may want to disable this feature so that Redis will
  403. # continue to work as usual even if there are problems with disk,
  404. # permissions, and so forth.
  405. stop-writes-on-bgsave-error yes
  406. # Compress string objects using LZF when dump .rdb databases?
  407. # By default compression is enabled as it's almost always a win.
  408. # If you want to save some CPU in the saving child set it to 'no' but
  409. # the dataset will likely be bigger if you have compressible values or keys.
  410. rdbcompression yes
  411. # Since version 5 of RDB a CRC64 checksum is placed at the end of the file.
  412. # This makes the format more resistant to corruption but there is a performance
  413. # hit to pay (around 10%) when saving and loading RDB files, so you can disable it
  414. # for maximum performances.
  415. #
  416. # RDB files created with checksum disabled have a checksum of zero that will
  417. # tell the loading code to skip the check.
  418. rdbchecksum yes
  419. # Enables or disables full sanitization checks for ziplist and listpack etc when
  420. # loading an RDB or RESTORE payload. This reduces the chances of a assertion or
  421. # crash later on while processing commands.
  422. # Options:
  423. # no - Never perform full sanitization
  424. # yes - Always perform full sanitization
  425. # clients - Perform full sanitization only for user connections.
  426. # Excludes: RDB files, RESTORE commands received from the master
  427. # connection, and client connections which have the
  428. # skip-sanitize-payload ACL flag.
  429. # The default should be 'clients' but since it currently affects cluster
  430. # resharding via MIGRATE, it is temporarily set to 'no' by default.
  431. #
  432. # sanitize-dump-payload no
  433. # The filename where to dump the DB
  434. dbfilename dump.rdb
  435. # Remove RDB files used by replication in instances without persistence
  436. # enabled. By default this option is disabled, however there are environments
  437. # where for regulations or other security concerns, RDB files persisted on
  438. # disk by masters in order to feed replicas, or stored on disk by replicas
  439. # in order to load them for the initial synchronization, should be deleted
  440. # ASAP. Note that this option ONLY WORKS in instances that have both AOF
  441. # and RDB persistence disabled, otherwise is completely ignored.
  442. #
  443. # An alternative (and sometimes better) way to obtain the same effect is
  444. # to use diskless replication on both master and replicas instances. However
  445. # in the case of replicas, diskless is not always an option.
  446. rdb-del-sync-files no
  447. # The working directory.
  448. #
  449. # The DB will be written inside this directory, with the filename specified
  450. # above using the 'dbfilename' configuration directive.
  451. #
  452. # The Append Only File will also be created inside this directory.
  453. #
  454. # Note that you must specify a directory here, not a file name.
  455. dir ./
  456. ################################# REPLICATION #################################
  457. # Master-Replica replication. Use replicaof to make a Redis instance a copy of
  458. # another Redis server. A few things to understand ASAP about Redis replication.
  459. #
  460. # +------------------+ +---------------+
  461. # | Master | ---> | Replica |
  462. # | (receive writes) | | (exact copy) |
  463. # +------------------+ +---------------+
  464. #
  465. # 1) Redis replication is asynchronous, but you can configure a master to
  466. # stop accepting writes if it appears to be not connected with at least
  467. # a given number of replicas.
  468. # 2) Redis replicas are able to perform a partial resynchronization with the
  469. # master if the replication link is lost for a relatively small amount of
  470. # time. You may want to configure the replication backlog size (see the next
  471. # sections of this file) with a sensible value depending on your needs.
  472. # 3) Replication is automatic and does not need user intervention. After a
  473. # network partition replicas automatically try to reconnect to masters
  474. # and resynchronize with them.
  475. #
  476. # replicaof <masterip> <masterport>
  477. # If the master is password protected (using the "requirepass" configuration
  478. # directive below) it is possible to tell the replica to authenticate before
  479. # starting the replication synchronization process, otherwise the master will
  480. # refuse the replica request.
  481. #
  482. # masterauth <master-password>
  483. #
  484. # However this is not enough if you are using Redis ACLs (for Redis version
  485. # 6 or greater), and the default user is not capable of running the PSYNC
  486. # command and/or other commands needed for replication. In this case it's
  487. # better to configure a special user to use with replication, and specify the
  488. # masteruser configuration as such:
  489. #
  490. # masteruser <username>
  491. #
  492. # When masteruser is specified, the replica will authenticate against its
  493. # master using the new AUTH form: AUTH <username> <password>.
  494. # When a replica loses its connection with the master, or when the replication
  495. # is still in progress, the replica can act in two different ways:
  496. #
  497. # 1) if replica-serve-stale-data is set to 'yes' (the default) the replica will
  498. # still reply to client requests, possibly with out of date data, or the
  499. # data set may just be empty if this is the first synchronization.
  500. #
  501. # 2) If replica-serve-stale-data is set to 'no' the replica will reply with error
  502. # "MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'"
  503. # to all data access commands, excluding commands such as:
  504. # INFO, REPLICAOF, AUTH, SHUTDOWN, REPLCONF, ROLE, CONFIG, SUBSCRIBE,
  505. # UNSUBSCRIBE, PSUBSCRIBE, PUNSUBSCRIBE, PUBLISH, PUBSUB, COMMAND, POST,
  506. # HOST and LATENCY.
  507. #
  508. replica-serve-stale-data yes
  509. # You can configure a replica instance to accept writes or not. Writing against
  510. # a replica instance may be useful to store some ephemeral data (because data
  511. # written on a replica will be easily deleted after resync with the master) but
  512. # may also cause problems if clients are writing to it because of a
  513. # misconfiguration.
  514. #
  515. # Since Redis 2.6 by default replicas are read-only.
  516. #
  517. # Note: read only replicas are not designed to be exposed to untrusted clients
  518. # on the internet. It's just a protection layer against misuse of the instance.
  519. # Still a read only replica exports by default all the administrative commands
  520. # such as CONFIG, DEBUG, and so forth. To a limited extent you can improve
  521. # security of read only replicas using 'rename-command' to shadow all the
  522. # administrative / dangerous commands.
  523. replica-read-only yes
  524. # Replication SYNC strategy: disk or socket.
  525. #
  526. # New replicas and reconnecting replicas that are not able to continue the
  527. # replication process just receiving differences, need to do what is called a
  528. # "full synchronization". An RDB file is transmitted from the master to the
  529. # replicas.
  530. #
  531. # The transmission can happen in two different ways:
  532. #
  533. # 1) Disk-backed: The Redis master creates a new process that writes the RDB
  534. # file on disk. Later the file is transferred by the parent
  535. # process to the replicas incrementally.
  536. # 2) Diskless: The Redis master creates a new process that directly writes the
  537. # RDB file to replica sockets, without touching the disk at all.
  538. #
  539. # With disk-backed replication, while the RDB file is generated, more replicas
  540. # can be queued and served with the RDB file as soon as the current child
  541. # producing the RDB file finishes its work. With diskless replication instead
  542. # once the transfer starts, new replicas arriving will be queued and a new
  543. # transfer will start when the current one terminates.
  544. #
  545. # When diskless replication is used, the master waits a configurable amount of
  546. # time (in seconds) before starting the transfer in the hope that multiple
  547. # replicas will arrive and the transfer can be parallelized.
  548. #
  549. # With slow disks and fast (large bandwidth) networks, diskless replication
  550. # works better.
  551. repl-diskless-sync yes
  552. # When diskless replication is enabled, it is possible to configure the delay
  553. # the server waits in order to spawn the child that transfers the RDB via socket
  554. # to the replicas.
  555. #
  556. # This is important since once the transfer starts, it is not possible to serve
  557. # new replicas arriving, that will be queued for the next RDB transfer, so the
  558. # server waits a delay in order to let more replicas arrive.
  559. #
  560. # The delay is specified in seconds, and by default is 5 seconds. To disable
  561. # it entirely just set it to 0 seconds and the transfer will start ASAP.
  562. repl-diskless-sync-delay 5
  563. # When diskless replication is enabled with a delay, it is possible to let
  564. # the replication start before the maximum delay is reached if the maximum
  565. # number of replicas expected have connected. Default of 0 means that the
  566. # maximum is not defined and Redis will wait the full delay.
  567. repl-diskless-sync-max-replicas 0
  568. # -----------------------------------------------------------------------------
  569. # WARNING: Since in this setup the replica does not immediately store an RDB on
  570. # disk, it may cause data loss during failovers. RDB diskless load + Redis
  571. # modules not handling I/O reads may cause Redis to abort in case of I/O errors
  572. # during the initial synchronization stage with the master.
  573. # -----------------------------------------------------------------------------
  574. #
  575. # Replica can load the RDB it reads from the replication link directly from the
  576. # socket, or store the RDB to a file and read that file after it was completely
  577. # received from the master.
  578. #
  579. # In many cases the disk is slower than the network, and storing and loading
  580. # the RDB file may increase replication time (and even increase the master's
  581. # Copy on Write memory and replica buffers).
  582. # However, when parsing the RDB file directly from the socket, in order to avoid
  583. # data loss it's only safe to flush the current dataset when the new dataset is
  584. # fully loaded in memory, resulting in higher memory usage.
  585. # For this reason we have the following options:
  586. #
  587. # "disabled" - Don't use diskless load (store the rdb file to the disk first)
  588. # "swapdb" - Keep current db contents in RAM while parsing the data directly
  589. # from the socket. Replicas in this mode can keep serving current
  590. # dataset while replication is in progress, except for cases where
  591. # they can't recognize master as having a data set from same
  592. # replication history.
  593. # Note that this requires sufficient memory, if you don't have it,
  594. # you risk an OOM kill.
  595. # "on-empty-db" - Use diskless load only when current dataset is empty. This is
  596. # safer and avoid having old and new dataset loaded side by side
  597. # during replication.
  598. repl-diskless-load disabled
  599. # Master send PINGs to its replicas in a predefined interval. It's possible to
  600. # change this interval with the repl_ping_replica_period option. The default
  601. # value is 10 seconds.
  602. #
  603. # repl-ping-replica-period 10
  604. # The following option sets the replication timeout for:
  605. #
  606. # 1) Bulk transfer I/O during SYNC, from the point of view of replica.
  607. # 2) Master timeout from the point of view of replicas (data, pings).
  608. # 3) Replica timeout from the point of view of masters (REPLCONF ACK pings).
  609. #
  610. # It is important to make sure that this value is greater than the value
  611. # specified for repl-ping-replica-period otherwise a timeout will be detected
  612. # every time there is low traffic between the master and the replica. The default
  613. # value is 60 seconds.
  614. #
  615. # repl-timeout 60
  616. # Disable TCP_NODELAY on the replica socket after SYNC?
  617. #
  618. # If you select "yes" Redis will use a smaller number of TCP packets and
  619. # less bandwidth to send data to replicas. But this can add a delay for
  620. # the data to appear on the replica side, up to 40 milliseconds with
  621. # Linux kernels using a default configuration.
  622. #
  623. # If you select "no" the delay for data to appear on the replica side will
  624. # be reduced but more bandwidth will be used for replication.
  625. #
  626. # By default we optimize for low latency, but in very high traffic conditions
  627. # or when the master and replicas are many hops away, turning this to "yes" may
  628. # be a good idea.
  629. repl-disable-tcp-nodelay no
  630. # Set the replication backlog size. The backlog is a buffer that accumulates
  631. # replica data when replicas are disconnected for some time, so that when a
  632. # replica wants to reconnect again, often a full resync is not needed, but a
  633. # partial resync is enough, just passing the portion of data the replica
  634. # missed while disconnected.
  635. #
  636. # The bigger the replication backlog, the longer the replica can endure the
  637. # disconnect and later be able to perform a partial resynchronization.
  638. #
  639. # The backlog is only allocated if there is at least one replica connected.
  640. #
  641. # repl-backlog-size 1mb
  642. # After a master has no connected replicas for some time, the backlog will be
  643. # freed. The following option configures the amount of seconds that need to
  644. # elapse, starting from the time the last replica disconnected, for the backlog
  645. # buffer to be freed.
  646. #
  647. # Note that replicas never free the backlog for timeout, since they may be
  648. # promoted to masters later, and should be able to correctly "partially
  649. # resynchronize" with other replicas: hence they should always accumulate backlog.
  650. #
  651. # A value of 0 means to never release the backlog.
  652. #
  653. # repl-backlog-ttl 3600
  654. # The replica priority is an integer number published by Redis in the INFO
  655. # output. It is used by Redis Sentinel in order to select a replica to promote
  656. # into a master if the master is no longer working correctly.
  657. #
  658. # A replica with a low priority number is considered better for promotion, so
  659. # for instance if there are three replicas with priority 10, 100, 25 Sentinel
  660. # will pick the one with priority 10, that is the lowest.
  661. #
  662. # However a special priority of 0 marks the replica as not able to perform the
  663. # role of master, so a replica with priority of 0 will never be selected by
  664. # Redis Sentinel for promotion.
  665. #
  666. # By default the priority is 100.
  667. replica-priority 100
  668. # The propagation error behavior controls how Redis will behave when it is
  669. # unable to handle a command being processed in the replication stream from a master
  670. # or processed while reading from an AOF file. Errors that occur during propagation
  671. # are unexpected, and can cause data inconsistency. However, there are edge cases
  672. # in earlier versions of Redis where it was possible for the server to replicate or persist
  673. # commands that would fail on future versions. For this reason the default behavior
  674. # is to ignore such errors and continue processing commands.
  675. #
  676. # If an application wants to ensure there is no data divergence, this configuration
  677. # should be set to 'panic' instead. The value can also be set to 'panic-on-replicas'
  678. # to only panic when a replica encounters an error on the replication stream. One of
  679. # these two panic values will become the default value in the future once there are
  680. # sufficient safety mechanisms in place to prevent false positive crashes.
  681. #
  682. # propagation-error-behavior ignore
  683. # Replica ignore disk write errors controls the behavior of a replica when it is
  684. # unable to persist a write command received from its master to disk. By default,
  685. # this configuration is set to 'no' and will crash the replica in this condition.
  686. # It is not recommended to change this default, however in order to be compatible
  687. # with older versions of Redis this config can be toggled to 'yes' which will just
  688. # log a warning and execute the write command it got from the master.
  689. #
  690. # replica-ignore-disk-write-errors no
  691. # -----------------------------------------------------------------------------
  692. # By default, Redis Sentinel includes all replicas in its reports. A replica
  693. # can be excluded from Redis Sentinel's announcements. An unannounced replica
  694. # will be ignored by the 'sentinel replicas <master>' command and won't be
  695. # exposed to Redis Sentinel's clients.
  696. #
  697. # This option does not change the behavior of replica-priority. Even with
  698. # replica-announced set to 'no', the replica can be promoted to master. To
  699. # prevent this behavior, set replica-priority to 0.
  700. #
  701. # replica-announced yes
  702. # It is possible for a master to stop accepting writes if there are less than
  703. # N replicas connected, having a lag less or equal than M seconds.
  704. #
  705. # The N replicas need to be in "online" state.
  706. #
  707. # The lag in seconds, that must be <= the specified value, is calculated from
  708. # the last ping received from the replica, that is usually sent every second.
  709. #
  710. # This option does not GUARANTEE that N replicas will accept the write, but
  711. # will limit the window of exposure for lost writes in case not enough replicas
  712. # are available, to the specified number of seconds.
  713. #
  714. # For example to require at least 3 replicas with a lag <= 10 seconds use:
  715. #
  716. # min-replicas-to-write 3
  717. # min-replicas-max-lag 10
  718. #
  719. # Setting one or the other to 0 disables the feature.
  720. #
  721. # By default min-replicas-to-write is set to 0 (feature disabled) and
  722. # min-replicas-max-lag is set to 10.
  723. # A Redis master is able to list the address and port of the attached
  724. # replicas in different ways. For example the "INFO replication" section
  725. # offers this information, which is used, among other tools, by
  726. # Redis Sentinel in order to discover replica instances.
  727. # Another place where this info is available is in the output of the
  728. # "ROLE" command of a master.
  729. #
  730. # The listed IP address and port normally reported by a replica is
  731. # obtained in the following way:
  732. #
  733. # IP: The address is auto detected by checking the peer address
  734. # of the socket used by the replica to connect with the master.
  735. #
  736. # Port: The port is communicated by the replica during the replication
  737. # handshake, and is normally the port that the replica is using to
  738. # listen for connections.
  739. #
  740. # However when port forwarding or Network Address Translation (NAT) is
  741. # used, the replica may actually be reachable via different IP and port
  742. # pairs. The following two options can be used by a replica in order to
  743. # report to its master a specific set of IP and port, so that both INFO
  744. # and ROLE will report those values.
  745. #
  746. # There is no need to use both the options if you need to override just
  747. # the port or the IP address.
  748. #
  749. # replica-announce-ip 5.5.5.5
  750. # replica-announce-port 1234
  751. ############################### KEYS TRACKING #################################
  752. # Redis implements server assisted support for client side caching of values.
  753. # This is implemented using an invalidation table that remembers, using
  754. # a radix key indexed by key name, what clients have which keys. In turn
  755. # this is used in order to send invalidation messages to clients. Please
  756. # check this page to understand more about the feature:
  757. #
  758. # https://redis.io/topics/client-side-caching
  759. #
  760. # When tracking is enabled for a client, all the read only queries are assumed
  761. # to be cached: this will force Redis to store information in the invalidation
  762. # table. When keys are modified, such information is flushed away, and
  763. # invalidation messages are sent to the clients. However if the workload is
  764. # heavily dominated by reads, Redis could use more and more memory in order
  765. # to track the keys fetched by many clients.
  766. #
  767. # For this reason it is possible to configure a maximum fill value for the
  768. # invalidation table. By default it is set to 1M of keys, and once this limit
  769. # is reached, Redis will start to evict keys in the invalidation table
  770. # even if they were not modified, just to reclaim memory: this will in turn
  771. # force the clients to invalidate the cached values. Basically the table
  772. # maximum size is a trade off between the memory you want to spend server
  773. # side to track information about who cached what, and the ability of clients
  774. # to retain cached objects in memory.
  775. #
  776. # If you set the value to 0, it means there are no limits, and Redis will
  777. # retain as many keys as needed in the invalidation table.
  778. # In the "stats" INFO section, you can find information about the number of
  779. # keys in the invalidation table at every given moment.
  780. #
  781. # Note: when key tracking is used in broadcasting mode, no memory is used
  782. # in the server side so this setting is useless.
  783. #
  784. # tracking-table-max-keys 1000000
  785. ################################## SECURITY ###################################
  786. # Warning: since Redis is pretty fast, an outside user can try up to
  787. # 1 million passwords per second against a modern box. This means that you
  788. # should use very strong passwords, otherwise they will be very easy to break.
  789. # Note that because the password is really a platform secret between the client
  790. # and the server, and should not be memorized by any human, the password
  791. # can be easily a long string from /dev/urandom or whatever, so by using a
  792. # long and unguessable password no brute force attack will be possible.
  793. # Redis ACL users are defined in the following format:
  794. #
  795. # user <username> ... acl rules ...
  796. #
  797. # For example:
  798. #
  799. # user worker +@list +@connection ~jobs:* on >ffa9203c493aa99
  800. #
  801. # The special username "default" is used for new connections. If this user
  802. # has the "nopass" rule, then new connections will be immediately authenticated
  803. # as the "default" user without the need of any password provided via the
  804. # AUTH command. Otherwise if the "default" user is not flagged with "nopass"
  805. # the connections will start in not authenticated state, and will require
  806. # AUTH (or the HELLO command AUTH option) in order to be authenticated and
  807. # start to work.
  808. #
  809. # The ACL rules that describe what a user can do are the following:
  810. #
  811. # on Enable the user: it is possible to authenticate as this user.
  812. # off Disable the user: it's no longer possible to authenticate
  813. # with this user, however the already authenticated connections
  814. # will still work.
  815. # skip-sanitize-payload RESTORE dump-payload sanitization is skipped.
  816. # sanitize-payload RESTORE dump-payload is sanitized (default).
  817. # +<command> Allow the execution of that command.
  818. # May be used with `|` for allowing subcommands (e.g "+config|get")
  819. # -<command> Disallow the execution of that command.
  820. # May be used with `|` for blocking subcommands (e.g "-config|set")
  821. # +@<category> Allow the execution of all the commands in such category
  822. # with valid categories are like @admin, @set, @sortedset, ...
  823. # and so forth, see the full list in the server.c file where
  824. # the Redis command table is described and defined.
  825. # The special category @all means all the commands, but currently
  826. # present in the server, and that will be loaded in the future
  827. # via modules.
  828. # +<command>|first-arg Allow a specific first argument of an otherwise
  829. # disabled command. It is only supported on commands with
  830. # no sub-commands, and is not allowed as negative form
  831. # like -SELECT|1, only additive starting with "+". This
  832. # feature is deprecated and may be removed in the future.
  833. # allcommands Alias for +@all. Note that it implies the ability to execute
  834. # all the future commands loaded via the modules system.
  835. # nocommands Alias for -@all.
  836. # ~<pattern> Add a pattern of keys that can be mentioned as part of
  837. # commands. For instance ~* allows all the keys. The pattern
  838. # is a glob-style pattern like the one of KEYS.
  839. # It is possible to specify multiple patterns.
  840. # %R~<pattern> Add key read pattern that specifies which keys can be read
  841. # from.
  842. # %W~<pattern> Add key write pattern that specifies which keys can be
  843. # written to.
  844. # allkeys Alias for ~*
  845. # resetkeys Flush the list of allowed keys patterns.
  846. # &<pattern> Add a glob-style pattern of Pub/Sub channels that can be
  847. # accessed by the user. It is possible to specify multiple channel
  848. # patterns.
  849. # allchannels Alias for &*
  850. # resetchannels Flush the list of allowed channel patterns.
  851. # ><password> Add this password to the list of valid password for the user.
  852. # For example >mypass will add "mypass" to the list.
  853. # This directive clears the "nopass" flag (see later).
  854. # <<password> Remove this password from the list of valid passwords.
  855. # nopass All the set passwords of the user are removed, and the user
  856. # is flagged as requiring no password: it means that every
  857. # password will work against this user. If this directive is
  858. # used for the default user, every new connection will be
  859. # immediately authenticated with the default user without
  860. # any explicit AUTH command required. Note that the "resetpass"
  861. # directive will clear this condition.
  862. # resetpass Flush the list of allowed passwords. Moreover removes the
  863. # "nopass" status. After "resetpass" the user has no associated
  864. # passwords and there is no way to authenticate without adding
  865. # some password (or setting it as "nopass" later).
  866. # reset Performs the following actions: resetpass, resetkeys, resetchannels,
  867. # allchannels (if acl-pubsub-default is set), off, clearselectors, -@all.
  868. # The user returns to the same state it has immediately after its creation.
  869. # (<options>) Create a new selector with the options specified within the
  870. # parentheses and attach it to the user. Each option should be
  871. # space separated. The first character must be ( and the last
  872. # character must be ).
  873. # clearselectors Remove all of the currently attached selectors.
  874. # Note this does not change the "root" user permissions,
  875. # which are the permissions directly applied onto the
  876. # user (outside the parentheses).
  877. #
  878. # ACL rules can be specified in any order: for instance you can start with
  879. # passwords, then flags, or key patterns. However note that the additive
  880. # and subtractive rules will CHANGE MEANING depending on the ordering.
  881. # For instance see the following example:
  882. #
  883. # user alice on +@all -DEBUG ~* >somepassword
  884. #
  885. # This will allow "alice" to use all the commands with the handler of the
  886. # DEBUG command, since +@all added all the commands to the set of the commands
  887. # alice can use, and later DEBUG was removed. However if we invert the order
  888. # of two ACL rules the result will be different:
  889. #
  890. # user alice on -DEBUG +@all ~* >somepassword
  891. #
  892. # Now DEBUG was removed when alice had yet no commands in the set of allowed
  893. # commands, later all the commands are added, so the user will be able to
  894. # execute everything.
  895. #
  896. # Basically ACL rules are processed left-to-right.
  897. #
  898. # The following is a list of command categories and their meanings:
  899. # * keyspace - Writing or reading from keys, databases, or their metadata
  900. # in a type agnostic way. Includes DEL, RESTORE, DUMP, RENAME, EXISTS, DBSIZE,
  901. # KEYS, EXPIRE, TTL, FLUSHALL, etc. Commands that may modify the keyspace,
  902. # key or metadata will also have `write` category. Commands that only read
  903. # the keyspace, key or metadata will have the `read` category.
  904. # * read - Reading from keys (values or metadata). Note that commands that don't
  905. # interact with keys, will not have either `read` or `write`.
  906. # * write - Writing to keys (values or metadata)
  907. # * admin - Administrative commands. Normal applications will never need to use
  908. # these. Includes REPLICAOF, CONFIG, DEBUG, SAVE, MONITOR, ACL, SHUTDOWN, etc.
  909. # * dangerous - Potentially dangerous (each should be considered with care for
  910. # various reasons). This includes FLUSHALL, MIGRATE, RESTORE, SORT, KEYS,
  911. # CLIENT, DEBUG, INFO, CONFIG, SAVE, REPLICAOF, etc.
  912. # * connection - Commands affecting the connection or other connections.
  913. # This includes AUTH, SELECT, COMMAND, CLIENT, ECHO, PING, etc.
  914. # * blocking - Potentially blocking the connection until released by another
  915. # command.
  916. # * fast - Fast O(1) commands. May loop on the number of arguments, but not the
  917. # number of elements in the key.
  918. # * slow - All commands that are not Fast.
  919. # * pubsub - PUBLISH / SUBSCRIBE related
  920. # * transaction - WATCH / MULTI / EXEC related commands.
  921. # * scripting - Scripting related.
  922. # * set - Data type: sets related.
  923. # * sortedset - Data type: zsets related.
  924. # * list - Data type: lists related.
  925. # * hash - Data type: hashes related.
  926. # * string - Data type: strings related.
  927. # * bitmap - Data type: bitmaps related.
  928. # * hyperloglog - Data type: hyperloglog related.
  929. # * geo - Data type: geo related.
  930. # * stream - Data type: streams related.
  931. #
  932. # For more information about ACL configuration please refer to
  933. # the Redis web site at https://redis.io/topics/acl
  934. # ACL LOG
  935. #
  936. # The ACL Log tracks failed commands and authentication events associated
  937. # with ACLs. The ACL Log is useful to troubleshoot failed commands blocked
  938. # by ACLs. The ACL Log is stored in memory. You can reclaim memory with
  939. # ACL LOG RESET. Define the maximum entry length of the ACL Log below.
  940. acllog-max-len 128
  941. # Using an external ACL file
  942. #
  943. # Instead of configuring users here in this file, it is possible to use
  944. # a stand-alone file just listing users. The two methods cannot be mixed:
  945. # if you configure users here and at the same time you activate the external
  946. # ACL file, the server will refuse to start.
  947. #
  948. # The format of the external ACL user file is exactly the same as the
  949. # format that is used inside redis.conf to describe users.
  950. #
  951. # aclfile /etc/redis/users.acl
  952. # IMPORTANT NOTE: starting with Redis 6 "requirepass" is just a compatibility
  953. # layer on top of the new ACL system. The option effect will be just setting
  954. # the password for the default user. Clients will still authenticate using
  955. # AUTH <password> as usually, or more explicitly with AUTH default <password>
  956. # if they follow the new protocol: both will work.
  957. #
  958. # The requirepass is not compatible with aclfile option and the ACL LOAD
  959. # command, these will cause requirepass to be ignored.
  960. #
  961. # requirepass foobared
  962. # New users are initialized with restrictive permissions by default, via the
  963. # equivalent of this ACL rule 'off resetkeys -@all'. Starting with Redis 6.2, it
  964. # is possible to manage access to Pub/Sub channels with ACL rules as well. The
  965. # default Pub/Sub channels permission if new users is controlled by the
  966. # acl-pubsub-default configuration directive, which accepts one of these values:
  967. #
  968. # allchannels: grants access to all Pub/Sub channels
  969. # resetchannels: revokes access to all Pub/Sub channels
  970. #
  971. # From Redis 7.0, acl-pubsub-default defaults to 'resetchannels' permission.
  972. #
  973. # acl-pubsub-default resetchannels
  974. # Command renaming (DEPRECATED).
  975. #
  976. # ------------------------------------------------------------------------
  977. # WARNING: avoid using this option if possible. Instead use ACLs to remove
  978. # commands from the default user, and put them only in some admin user you
  979. # create for administrative purposes.
  980. # ------------------------------------------------------------------------
  981. #
  982. # It is possible to change the name of dangerous commands in a platform
  983. # environment. For instance the CONFIG command may be renamed into something
  984. # hard to guess so that it will still be available for internal-use tools
  985. # but not available for general clients.
  986. #
  987. # Example:
  988. #
  989. # rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
  990. #
  991. # It is also possible to completely kill a command by renaming it into
  992. # an empty string:
  993. #
  994. # rename-command CONFIG ""
  995. #
  996. # Please note that changing the name of commands that are logged into the
  997. # AOF file or transmitted to replicas may cause problems.
  998. ################################### CLIENTS ####################################
  999. # Set the max number of connected clients at the same time. By default
  1000. # this limit is set to 10000 clients, however if the Redis server is not
  1001. # able to configure the process file limit to allow for the specified limit
  1002. # the max number of allowed clients is set to the current file limit
  1003. # minus 32 (as Redis reserves a few file descriptors for internal uses).
  1004. #
  1005. # Once the limit is reached Redis will close all the new connections sending
  1006. # an error 'max number of clients reached'.
  1007. #
  1008. # IMPORTANT: When Redis Cluster is used, the max number of connections is also
  1009. # platform with the cluster bus: every node in the cluster will use two
  1010. # connections, one incoming and another outgoing. It is important to size the
  1011. # limit accordingly in case of very large clusters.
  1012. #
  1013. # maxclients 10000
  1014. ############################## MEMORY MANAGEMENT ################################
  1015. # Set a memory usage limit to the specified amount of bytes.
  1016. # When the memory limit is reached Redis will try to remove keys
  1017. # according to the eviction policy selected (see maxmemory-policy).
  1018. #
  1019. # If Redis can't remove keys according to the policy, or if the policy is
  1020. # set to 'noeviction', Redis will start to reply with errors to commands
  1021. # that would use more memory, like SET, LPUSH, and so on, and will continue
  1022. # to reply to read-only commands like GET.
  1023. #
  1024. # This option is usually useful when using Redis as an LRU or LFU cache, or to
  1025. # set a hard memory limit for an instance (using the 'noeviction' policy).
  1026. #
  1027. # WARNING: If you have replicas attached to an instance with maxmemory on,
  1028. # the size of the output buffers needed to feed the replicas are subtracted
  1029. # from the used memory count, so that network problems / resyncs will
  1030. # not trigger a loop where keys are evicted, and in turn the output
  1031. # buffer of replicas is full with DELs of keys evicted triggering the deletion
  1032. # of more keys, and so forth until the database is completely emptied.
  1033. #
  1034. # In short... if you have replicas attached it is suggested that you set a lower
  1035. # limit for maxmemory so that there is some free RAM on the system for replica
  1036. # output buffers (but this is not needed if the policy is 'noeviction').
  1037. #
  1038. # maxmemory <bytes>
  1039. # MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
  1040. # is reached. You can select one from the following behaviors:
  1041. #
  1042. # volatile-lru -> Evict using approximated LRU, only keys with an expire set.
  1043. # allkeys-lru -> Evict any key using approximated LRU.
  1044. # volatile-lfu -> Evict using approximated LFU, only keys with an expire set.
  1045. # allkeys-lfu -> Evict any key using approximated LFU.
  1046. # volatile-random -> Remove a random key having an expire set.
  1047. # allkeys-random -> Remove a random key, any key.
  1048. # volatile-ttl -> Remove the key with the nearest expire time (minor TTL)
  1049. # noeviction -> Don't evict anything, just return an error on write operations.
  1050. #
  1051. # LRU means Least Recently Used
  1052. # LFU means Least Frequently Used
  1053. #
  1054. # Both LRU, LFU and volatile-ttl are implemented using approximated
  1055. # randomized algorithms.
  1056. #
  1057. # Note: with any of the above policies, when there are no suitable keys for
  1058. # eviction, Redis will return an error on write operations that require
  1059. # more memory. These are usually commands that create new keys, add data or
  1060. # modify existing keys. A few examples are: SET, INCR, HSET, LPUSH, SUNIONSTORE,
  1061. # SORT (due to the STORE argument), and EXEC (if the transaction includes any
  1062. # command that requires memory).
  1063. #
  1064. # The default is:
  1065. #
  1066. # maxmemory-policy noeviction
  1067. # LRU, LFU and minimal TTL algorithms are not precise algorithms but approximated
  1068. # algorithms (in order to save memory), so you can tune it for speed or
  1069. # accuracy. By default Redis will check five keys and pick the one that was
  1070. # used least recently, you can change the sample size using the following
  1071. # configuration directive.
  1072. #
  1073. # The default of 5 produces good enough results. 10 Approximates very closely
  1074. # true LRU but costs more CPU. 3 is faster but not very accurate.
  1075. #
  1076. # maxmemory-samples 5
  1077. # Eviction processing is designed to function well with the default setting.
  1078. # If there is an unusually large amount of write traffic, this value may need to
  1079. # be increased. Decreasing this value may reduce latency at the risk of
  1080. # eviction processing effectiveness
  1081. # 0 = minimum latency, 10 = default, 100 = process without regard to latency
  1082. #
  1083. # maxmemory-eviction-tenacity 10
  1084. # Starting from Redis 5, by default a replica will ignore its maxmemory setting
  1085. # (unless it is promoted to master after a failover or manually). It means
  1086. # that the eviction of keys will be just handled by the master, sending the
  1087. # DEL commands to the replica as keys evict in the master side.
  1088. #
  1089. # This behavior ensures that masters and replicas stay consistent, and is usually
  1090. # what you want, however if your replica is writable, or you want the replica
  1091. # to have a different memory setting, and you are sure all the writes performed
  1092. # to the replica are idempotent, then you may change this default (but be sure
  1093. # to understand what you are doing).
  1094. #
  1095. # Note that since the replica by default does not evict, it may end using more
  1096. # memory than the one set via maxmemory (there are certain buffers that may
  1097. # be larger on the replica, or data structures may sometimes take more memory
  1098. # and so forth). So make sure you monitor your replicas and make sure they
  1099. # have enough memory to never hit a real out-of-memory condition before the
  1100. # master hits the configured maxmemory setting.
  1101. #
  1102. # replica-ignore-maxmemory yes
  1103. # Redis reclaims expired keys in two ways: upon access when those keys are
  1104. # found to be expired, and also in background, in what is called the
  1105. # "active expire key". The key space is slowly and interactively scanned
  1106. # looking for expired keys to reclaim, so that it is possible to free memory
  1107. # of keys that are expired and will never be accessed again in a short time.
  1108. #
  1109. # The default effort of the expire cycle will try to avoid having more than
  1110. # ten percent of expired keys still in memory, and will try to avoid consuming
  1111. # more than 25% of total memory and to add latency to the system. However
  1112. # it is possible to increase the expire "effort" that is normally set to
  1113. # "1", to a greater value, up to the value "10". At its maximum value the
  1114. # system will use more CPU, longer cycles (and technically may introduce
  1115. # more latency), and will tolerate less already expired keys still present
  1116. # in the system. It's a tradeoff between memory, CPU and latency.
  1117. #
  1118. # active-expire-effort 1
  1119. ############################# LAZY FREEING ####################################
  1120. # Redis has two primitives to delete keys. One is called DEL and is a blocking
  1121. # deletion of the object. It means that the server stops processing new commands
  1122. # in order to reclaim all the memory associated with an object in a synchronous
  1123. # way. If the key deleted is associated with a small object, the time needed
  1124. # in order to execute the DEL command is very small and comparable to most other
  1125. # O(1) or O(log_N) commands in Redis. However if the key is associated with an
  1126. # aggregated value containing millions of elements, the server can block for
  1127. # a long time (even seconds) in order to complete the operation.
  1128. #
  1129. # For the above reasons Redis also offers non blocking deletion primitives
  1130. # such as UNLINK (non blocking DEL) and the ASYNC option of FLUSHALL and
  1131. # FLUSHDB commands, in order to reclaim memory in background. Those commands
  1132. # are executed in constant time. Another thread will incrementally free the
  1133. # object in the background as fast as possible.
  1134. #
  1135. # DEL, UNLINK and ASYNC option of FLUSHALL and FLUSHDB are user-controlled.
  1136. # It's up to the design of the application to understand when it is a good
  1137. # idea to use one or the other. However the Redis server sometimes has to
  1138. # delete keys or flush the whole database as a side effect of other operations.
  1139. # Specifically Redis deletes objects independently of a user call in the
  1140. # following scenarios:
  1141. #
  1142. # 1) On eviction, because of the maxmemory and maxmemory policy configurations,
  1143. # in order to make room for new data, without going over the specified
  1144. # memory limit.
  1145. # 2) Because of expire: when a key with an associated time to live (see the
  1146. # EXPIRE command) must be deleted from memory.
  1147. # 3) Because of a side effect of a command that stores data on a key that may
  1148. # already exist. For example the RENAME command may delete the old key
  1149. # content when it is replaced with another one. Similarly SUNIONSTORE
  1150. # or SORT with STORE option may delete existing keys. The SET command
  1151. # itself removes any old content of the specified key in order to replace
  1152. # it with the specified string.
  1153. # 4) During replication, when a replica performs a full resynchronization with
  1154. # its master, the content of the whole database is removed in order to
  1155. # load the RDB file just transferred.
  1156. #
  1157. # In all the above cases the default is to delete objects in a blocking way,
  1158. # like if DEL was called. However you can configure each case specifically
  1159. # in order to instead release memory in a non-blocking way like if UNLINK
  1160. # was called, using the following configuration directives.
  1161. lazyfree-lazy-eviction no
  1162. lazyfree-lazy-expire no
  1163. lazyfree-lazy-server-del no
  1164. replica-lazy-flush no
  1165. # It is also possible, for the case when to replace the user code DEL calls
  1166. # with UNLINK calls is not easy, to modify the default behavior of the DEL
  1167. # command to act exactly like UNLINK, using the following configuration
  1168. # directive:
  1169. lazyfree-lazy-user-del no
  1170. # FLUSHDB, FLUSHALL, SCRIPT FLUSH and FUNCTION FLUSH support both asynchronous and synchronous
  1171. # deletion, which can be controlled by passing the [SYNC|ASYNC] flags into the
  1172. # commands. When neither flag is passed, this directive will be used to determine
  1173. # if the data should be deleted asynchronously.
  1174. lazyfree-lazy-user-flush no
  1175. ################################ THREADED I/O #################################
  1176. # Redis is mostly single threaded, however there are certain threaded
  1177. # operations such as UNLINK, slow I/O accesses and other things that are
  1178. # performed on side threads.
  1179. #
  1180. # Now it is also possible to handle Redis clients socket reads and writes
  1181. # in different I/O threads. Since especially writing is so slow, normally
  1182. # Redis users use pipelining in order to speed up the Redis performances per
  1183. # core, and spawn multiple instances in order to scale more. Using I/O
  1184. # threads it is possible to easily speedup two times Redis without resorting
  1185. # to pipelining nor sharding of the instance.
  1186. #
  1187. # By default threading is disabled, we suggest enabling it only in machines
  1188. # that have at least 4 or more cores, leaving at least one spare core.
  1189. # Using more than 8 threads is unlikely to help much. We also recommend using
  1190. # threaded I/O only if you actually have performance problems, with Redis
  1191. # instances being able to use a quite big percentage of CPU time, otherwise
  1192. # there is no point in using this feature.
  1193. #
  1194. # So for instance if you have a four cores boxes, try to use 2 or 3 I/O
  1195. # threads, if you have a 8 cores, try to use 6 threads. In order to
  1196. # enable I/O threads use the following configuration directive:
  1197. #
  1198. # io-threads 4
  1199. #
  1200. # Setting io-threads to 1 will just use the main thread as usual.
  1201. # When I/O threads are enabled, we only use threads for writes, that is
  1202. # to thread the write(2) syscall and transfer the client buffers to the
  1203. # socket. However it is also possible to enable threading of reads and
  1204. # protocol parsing using the following configuration directive, by setting
  1205. # it to yes:
  1206. #
  1207. # io-threads-do-reads no
  1208. #
  1209. # Usually threading reads doesn't help much.
  1210. #
  1211. # NOTE 1: This configuration directive cannot be changed at runtime via
  1212. # CONFIG SET. Also, this feature currently does not work when SSL is
  1213. # enabled.
  1214. #
  1215. # NOTE 2: If you want to test the Redis speedup using redis-benchmark, make
  1216. # sure you also run the benchmark itself in threaded mode, using the
  1217. # --threads option to match the number of Redis threads, otherwise you'll not
  1218. # be able to notice the improvements.
  1219. ############################ KERNEL OOM CONTROL ##############################
  1220. # On Linux, it is possible to hint the kernel OOM killer on what processes
  1221. # should be killed first when out of memory.
  1222. #
  1223. # Enabling this feature makes Redis actively control the oom_score_adj value
  1224. # for all its processes, depending on their role. The default scores will
  1225. # attempt to have background child processes killed before all others, and
  1226. # replicas killed before masters.
  1227. #
  1228. # Redis supports these options:
  1229. #
  1230. # no: Don't make changes to oom-score-adj (default).
  1231. # yes: Alias to "relative" see below.
  1232. # absolute: Values in oom-score-adj-values are written as is to the kernel.
  1233. # relative: Values are used relative to the initial value of oom_score_adj when
  1234. # the server starts and are then clamped to a range of -1000 to 1000.
  1235. # Because typically the initial value is 0, they will often match the
  1236. # absolute values.
  1237. oom-score-adj no
  1238. # When oom-score-adj is used, this directive controls the specific values used
  1239. # for master, replica and background child processes. Values range -2000 to
  1240. # 2000 (higher means more likely to be killed).
  1241. #
  1242. # Unprivileged processes (not root, and without CAP_SYS_RESOURCE capabilities)
  1243. # can freely increase their value, but not decrease it below its initial
  1244. # settings. This means that setting oom-score-adj to "relative" and setting the
  1245. # oom-score-adj-values to positive values will always succeed.
  1246. oom-score-adj-values 0 200 800
  1247. #################### KERNEL transparent hugepage CONTROL ######################
  1248. # Usually the kernel Transparent Huge Pages control is set to "madvise" or
  1249. # or "never" by default (/sys/kernel/mm/transparent_hugepage/enabled), in which
  1250. # case this config has no effect. On systems in which it is set to "always",
  1251. # redis will attempt to disable it specifically for the redis process in order
  1252. # to avoid latency problems specifically with fork(2) and CoW.
  1253. # If for some reason you prefer to keep it enabled, you can set this config to
  1254. # "no" and the kernel global to "always".
  1255. disable-thp yes
  1256. ############################## APPEND ONLY MODE ###############################
  1257. # By default Redis asynchronously dumps the dataset on disk. This mode is
  1258. # good enough in many applications, but an issue with the Redis process or
  1259. # a power outage may result into a few minutes of writes lost (depending on
  1260. # the configured save points).
  1261. #
  1262. # The Append Only File is an alternative persistence mode that provides
  1263. # much better durability. For instance using the default data fsync policy
  1264. # (see later in the config file) Redis can lose just one second of writes in a
  1265. # dramatic event like a server power outage, or a single write if something
  1266. # wrong with the Redis process itself happens, but the operating system is
  1267. # still running correctly.
  1268. #
  1269. # AOF and RDB persistence can be enabled at the same time without problems.
  1270. # If the AOF is enabled on startup Redis will load the AOF, that is the file
  1271. # with the better durability guarantees.
  1272. #
  1273. # Please check https://redis.io/topics/persistence for more information.
  1274. appendonly no
  1275. # The base name of the append only file.
  1276. #
  1277. # Redis 7 and newer use a set of append-only files to persist the dataset
  1278. # and changes applied to it. There are two basic types of files in use:
  1279. #
  1280. # - Base files, which are a snapshot representing the complete state of the
  1281. # dataset at the time the file was created. Base files can be either in
  1282. # the form of RDB (binary serialized) or AOF (textual commands).
  1283. # - Incremental files, which contain additional commands that were applied
  1284. # to the dataset following the previous file.
  1285. #
  1286. # In addition, manifest files are used to track the files and the order in
  1287. # which they were created and should be applied.
  1288. #
  1289. # Append-only file names are created by Redis following a specific pattern.
  1290. # The file name's prefix is based on the 'appendfilename' configuration
  1291. # parameter, followed by additional information about the sequence and type.
  1292. #
  1293. # For example, if appendfilename is set to appendonly.aof, the following file
  1294. # names could be derived:
  1295. #
  1296. # - appendonly.aof.1.base.rdb as a base file.
  1297. # - appendonly.aof.1.incr.aof, appendonly.aof.2.incr.aof as incremental files.
  1298. # - appendonly.aof.manifest as a manifest file.
  1299. appendfilename "appendonly.aof"
  1300. # For convenience, Redis stores all persistent append-only files in a dedicated
  1301. # directory. The name of the directory is determined by the appenddirname
  1302. # configuration parameter.
  1303. appenddirname "appendonlydir"
  1304. # The fsync() call tells the Operating System to actually write data on disk
  1305. # instead of waiting for more data in the output buffer. Some OS will really flush
  1306. # data on disk, some other OS will just try to do it ASAP.
  1307. #
  1308. # Redis supports three different modes:
  1309. #
  1310. # no: don't fsync, just let the OS flush the data when it wants. Faster.
  1311. # always: fsync after every write to the append only log. Slow, Safest.
  1312. # everysec: fsync only one time every second. Compromise.
  1313. #
  1314. # The default is "everysec", as that's usually the right compromise between
  1315. # speed and data safety. It's up to you to understand if you can relax this to
  1316. # "no" that will let the operating system flush the output buffer when
  1317. # it wants, for better performances (but if you can live with the idea of
  1318. # some data loss consider the default persistence mode that's snapshotting),
  1319. # or on the contrary, use "always" that's very slow but a bit safer than
  1320. # everysec.
  1321. #
  1322. # More details please check the following article:
  1323. # http://antirez.com/post/redis-persistence-demystified.html
  1324. #
  1325. # If unsure, use "everysec".
  1326. # appendfsync always
  1327. appendfsync everysec
  1328. # appendfsync no
  1329. # When the AOF fsync policy is set to always or everysec, and a background
  1330. # saving process (a background save or AOF log background rewriting) is
  1331. # performing a lot of I/O against the disk, in some Linux configurations
  1332. # Redis may block too long on the fsync() call. Note that there is no fix for
  1333. # this currently, as even performing fsync in a different thread will block
  1334. # our synchronous write(2) call.
  1335. #
  1336. # In order to mitigate this problem it's possible to use the following option
  1337. # that will prevent fsync() from being called in the main process while a
  1338. # BGSAVE or BGREWRITEAOF is in progress.
  1339. #
  1340. # This means that while another child is saving, the durability of Redis is
  1341. # the same as "appendfsync no". In practical terms, this means that it is
  1342. # possible to lose up to 30 seconds of log in the worst scenario (with the
  1343. # default Linux settings).
  1344. #
  1345. # If you have latency problems turn this to "yes". Otherwise leave it as
  1346. # "no" that is the safest pick from the point of view of durability.
  1347. no-appendfsync-on-rewrite no
  1348. # Automatic rewrite of the append only file.
  1349. # Redis is able to automatically rewrite the log file implicitly calling
  1350. # BGREWRITEAOF when the AOF log size grows by the specified percentage.
  1351. #
  1352. # This is how it works: Redis remembers the size of the AOF file after the
  1353. # latest rewrite (if no rewrite has happened since the restart, the size of
  1354. # the AOF at startup is used).
  1355. #
  1356. # This base size is compared to the current size. If the current size is
  1357. # bigger than the specified percentage, the rewrite is triggered. Also
  1358. # you need to specify a minimal size for the AOF file to be rewritten, this
  1359. # is useful to avoid rewriting the AOF file even if the percentage increase
  1360. # is reached but it is still pretty small.
  1361. #
  1362. # Specify a percentage of zero in order to disable the automatic AOF
  1363. # rewrite feature.
  1364. auto-aof-rewrite-percentage 100
  1365. auto-aof-rewrite-min-size 64mb
  1366. # An AOF file may be found to be truncated at the end during the Redis
  1367. # startup process, when the AOF data gets loaded back into memory.
  1368. # This may happen when the system where Redis is running
  1369. # crashes, especially when an ext4 filesystem is mounted without the
  1370. # data=ordered option (however this can't happen when Redis itself
  1371. # crashes or aborts but the operating system still works correctly).
  1372. #
  1373. # Redis can either exit with an error when this happens, or load as much
  1374. # data as possible (the default now) and start if the AOF file is found
  1375. # to be truncated at the end. The following option controls this behavior.
  1376. #
  1377. # If aof-load-truncated is set to yes, a truncated AOF file is loaded and
  1378. # the Redis server starts emitting a log to inform the user of the event.
  1379. # Otherwise if the option is set to no, the server aborts with an error
  1380. # and refuses to start. When the option is set to no, the user requires
  1381. # to fix the AOF file using the "redis-check-aof" utility before to restart
  1382. # the server.
  1383. #
  1384. # Note that if the AOF file will be found to be corrupted in the middle
  1385. # the server will still exit with an error. This option only applies when
  1386. # Redis will try to read more data from the AOF file but not enough bytes
  1387. # will be found.
  1388. aof-load-truncated yes
  1389. # Redis can create append-only base files in either RDB or AOF formats. Using
  1390. # the RDB format is always faster and more efficient, and disabling it is only
  1391. # supported for backward compatibility purposes.
  1392. aof-use-rdb-preamble yes
  1393. # Redis supports recording timestamp annotations in the AOF to support restoring
  1394. # the data from a specific point-in-time. However, using this capability changes
  1395. # the AOF format in a way that may not be compatible with existing AOF parsers.
  1396. aof-timestamp-enabled no
  1397. ################################ SHUTDOWN #####################################
  1398. # Maximum time to wait for replicas when shutting down, in seconds.
  1399. #
  1400. # During shut down, a grace period allows any lagging replicas to catch up with
  1401. # the latest replication offset before the master exists. This period can
  1402. # prevent data loss, especially for deployments without configured disk backups.
  1403. #
  1404. # The 'shutdown-timeout' value is the grace period's duration in seconds. It is
  1405. # only applicable when the instance has replicas. To disable the feature, set
  1406. # the value to 0.
  1407. #
  1408. # shutdown-timeout 10
  1409. # When Redis receives a SIGINT or SIGTERM, shutdown is initiated and by default
  1410. # an RDB snapshot is written to disk in a blocking operation if save points are configured.
  1411. # The options used on signaled shutdown can include the following values:
  1412. # default: Saves RDB snapshot only if save points are configured.
  1413. # Waits for lagging replicas to catch up.
  1414. # save: Forces a DB saving operation even if no save points are configured.
  1415. # nosave: Prevents DB saving operation even if one or more save points are configured.
  1416. # now: Skips waiting for lagging replicas.
  1417. # force: Ignores any errors that would normally prevent the server from exiting.
  1418. #
  1419. # Any combination of values is allowed as long as "save" and "nosave" are not set simultaneously.
  1420. # Example: "nosave force now"
  1421. #
  1422. # shutdown-on-sigint default
  1423. # shutdown-on-sigterm default
  1424. ################ NON-DETERMINISTIC LONG BLOCKING COMMANDS #####################
  1425. # Maximum time in milliseconds for EVAL scripts, functions and in some cases
  1426. # modules' commands before Redis can start processing or rejecting other clients.
  1427. #
  1428. # If the maximum execution time is reached Redis will start to reply to most
  1429. # commands with a BUSY error.
  1430. #
  1431. # In this state Redis will only allow a handful of commands to be executed.
  1432. # For instance, SCRIPT KILL, FUNCTION KILL, SHUTDOWN NOSAVE and possibly some
  1433. # business specific 'allow-busy' commands.
  1434. #
  1435. # SCRIPT KILL and FUNCTION KILL will only be able to stop a script that did not
  1436. # yet call any write commands, so SHUTDOWN NOSAVE may be the only way to stop
  1437. # the server in the case a write command was already issued by the script when
  1438. # the user doesn't want to wait for the natural termination of the script.
  1439. #
  1440. # The default is 5 seconds. It is possible to set it to 0 or a negative value
  1441. # to disable this mechanism (uninterrupted execution). Note that in the past
  1442. # this config had a different name, which is now an alias, so both of these do
  1443. # the same:
  1444. # lua-time-limit 5000
  1445. # busy-reply-threshold 5000
  1446. ################################ REDIS CLUSTER ###############################
  1447. # Normal Redis instances can't be part of a Redis Cluster; only nodes that are
  1448. # started as cluster nodes can. In order to start a Redis instance as a
  1449. # cluster node enable the cluster support uncommenting the following:
  1450. #
  1451. # cluster-enabled yes
  1452. # Every cluster node has a cluster configuration file. This file is not
  1453. # intended to be edited by hand. It is created and updated by Redis nodes.
  1454. # Every Redis Cluster node requires a different cluster configuration file.
  1455. # Make sure that instances running in the same system do not have
  1456. # overlapping cluster configuration file names.
  1457. #
  1458. # cluster-config-file nodes-6379.conf
  1459. # Cluster node timeout is the amount of milliseconds a node must be unreachable
  1460. # for it to be considered in failure state.
  1461. # Most other internal time limits are a multiple of the node timeout.
  1462. #
  1463. # cluster-node-timeout 15000
  1464. # The cluster port is the port that the cluster bus will listen for inbound connections on. When set
  1465. # to the default value, 0, it will be bound to the command port + 10000. Setting this value requires
  1466. # you to specify the cluster bus port when executing cluster meet.
  1467. # cluster-port 0
  1468. # A replica of a failing master will avoid to start a failover if its data
  1469. # looks too old.
  1470. #
  1471. # There is no simple way for a replica to actually have an exact measure of
  1472. # its "data age", so the following two checks are performed:
  1473. #
  1474. # 1) If there are multiple replicas able to failover, they exchange messages
  1475. # in order to try to give an advantage to the replica with the best
  1476. # replication offset (more data from the master processed).
  1477. # Replicas will try to get their rank by offset, and apply to the start
  1478. # of the failover a delay proportional to their rank.
  1479. #
  1480. # 2) Every single replica computes the time of the last interaction with
  1481. # its master. This can be the last ping or command received (if the master
  1482. # is still in the "connected" state), or the time that elapsed since the
  1483. # disconnection with the master (if the replication link is currently down).
  1484. # If the last interaction is too old, the replica will not try to failover
  1485. # at all.
  1486. #
  1487. # The point "2" can be tuned by user. Specifically a replica will not perform
  1488. # the failover if, since the last interaction with the master, the time
  1489. # elapsed is greater than:
  1490. #
  1491. # (node-timeout * cluster-replica-validity-factor) + repl-ping-replica-period
  1492. #
  1493. # So for example if node-timeout is 30 seconds, and the cluster-replica-validity-factor
  1494. # is 10, and assuming a default repl-ping-replica-period of 10 seconds, the
  1495. # replica will not try to failover if it was not able to talk with the master
  1496. # for longer than 310 seconds.
  1497. #
  1498. # A large cluster-replica-validity-factor may allow replicas with too old data to failover
  1499. # a master, while a too small value may prevent the cluster from being able to
  1500. # elect a replica at all.
  1501. #
  1502. # For maximum availability, it is possible to set the cluster-replica-validity-factor
  1503. # to a value of 0, which means, that replicas will always try to failover the
  1504. # master regardless of the last time they interacted with the master.
  1505. # (However they'll always try to apply a delay proportional to their
  1506. # offset rank).
  1507. #
  1508. # Zero is the only value able to guarantee that when all the partitions heal
  1509. # the cluster will always be able to continue.
  1510. #
  1511. # cluster-replica-validity-factor 10
  1512. # Cluster replicas are able to migrate to orphaned masters, that are masters
  1513. # that are left without working replicas. This improves the cluster ability
  1514. # to resist to failures as otherwise an orphaned master can't be failed over
  1515. # in case of failure if it has no working replicas.
  1516. #
  1517. # Replicas migrate to orphaned masters only if there are still at least a
  1518. # given number of other working replicas for their old master. This number
  1519. # is the "migration barrier". A migration barrier of 1 means that a replica
  1520. # will migrate only if there is at least 1 other working replica for its master
  1521. # and so forth. It usually reflects the number of replicas you want for every
  1522. # master in your cluster.
  1523. #
  1524. # Default is 1 (replicas migrate only if their masters remain with at least
  1525. # one replica). To disable migration just set it to a very large value or
  1526. # set cluster-allow-replica-migration to 'no'.
  1527. # A value of 0 can be set but is useful only for debugging and dangerous
  1528. # in production.
  1529. #
  1530. # cluster-migration-barrier 1
  1531. # Turning off this option allows to use less automatic cluster configuration.
  1532. # It both disables migration to orphaned masters and migration from masters
  1533. # that became empty.
  1534. #
  1535. # Default is 'yes' (allow automatic migrations).
  1536. #
  1537. # cluster-allow-replica-migration yes
  1538. # By default Redis Cluster nodes stop accepting queries if they detect there
  1539. # is at least a hash slot uncovered (no available node is serving it).
  1540. # This way if the cluster is partially down (for example a range of hash slots
  1541. # are no longer covered) all the cluster becomes, eventually, unavailable.
  1542. # It automatically returns available as soon as all the slots are covered again.
  1543. #
  1544. # However sometimes you want the subset of the cluster which is working,
  1545. # to continue to accept queries for the part of the key space that is still
  1546. # covered. In order to do so, just set the cluster-require-full-coverage
  1547. # option to no.
  1548. #
  1549. # cluster-require-full-coverage yes
  1550. # This option, when set to yes, prevents replicas from trying to failover its
  1551. # master during master failures. However the replica can still perform a
  1552. # manual failover, if forced to do so.
  1553. #
  1554. # This is useful in different scenarios, especially in the case of multiple
  1555. # data center operations, where we want one side to never be promoted if not
  1556. # in the case of a total DC failure.
  1557. #
  1558. # cluster-replica-no-failover no
  1559. # This option, when set to yes, allows nodes to serve read traffic while the
  1560. # cluster is in a down state, as long as it believes it owns the slots.
  1561. #
  1562. # This is useful for two cases. The first case is for when an application
  1563. # doesn't require consistency of data during node failures or network partitions.
  1564. # One example of this is a cache, where as long as the node has the data it
  1565. # should be able to serve it.
  1566. #
  1567. # The second use case is for configurations that don't meet the recommended
  1568. # three shards but want to enable cluster mode and scale later. A
  1569. # master outage in a 1 or 2 shard configuration causes a read/write outage to the
  1570. # entire cluster without this option set, with it set there is only a write outage.
  1571. # Without a quorum of masters, slot ownership will not change automatically.
  1572. #
  1573. # cluster-allow-reads-when-down no
  1574. # This option, when set to yes, allows nodes to serve pubsub shard traffic while
  1575. # the cluster is in a down state, as long as it believes it owns the slots.
  1576. #
  1577. # This is useful if the application would like to use the pubsub feature even when
  1578. # the cluster global stable state is not OK. If the application wants to make sure only
  1579. # one shard is serving a given channel, this feature should be kept as yes.
  1580. #
  1581. # cluster-allow-pubsubshard-when-down yes
  1582. # Cluster link send buffer limit is the limit on the memory usage of an individual
  1583. # cluster bus link's send buffer in bytes. Cluster links would be freed if they exceed
  1584. # this limit. This is to primarily prevent send buffers from growing unbounded on links
  1585. # toward slow peers (E.g. PubSub messages being piled up).
  1586. # This limit is disabled by default. Enable this limit when 'mem_cluster_links' INFO field
  1587. # and/or 'send-buffer-allocated' entries in the 'CLUSTER LINKS` command output continuously increase.
  1588. # Minimum limit of 1gb is recommended so that cluster link buffer can fit in at least a single
  1589. # PubSub message by default. (client-query-buffer-limit default value is 1gb)
  1590. #
  1591. # cluster-link-sendbuf-limit 0
  1592. # Clusters can configure their announced hostname using this config. This is a common use case for
  1593. # applications that need to use TLS Server Name Indication (SNI) or dealing with DNS based
  1594. # routing. By default this value is only shown as additional metadata in the CLUSTER SLOTS
  1595. # command, but can be changed using 'cluster-preferred-endpoint-type' config. This value is
  1596. # communicated along the clusterbus to all nodes, setting it to an empty string will remove
  1597. # the hostname and also propagate the removal.
  1598. #
  1599. # cluster-announce-hostname ""
  1600. # Clusters can configure an optional nodename to be used in addition to the node ID for
  1601. # debugging and admin information. This name is broadcasted between nodes, so will be used
  1602. # in addition to the node ID when reporting cross node events such as node failures.
  1603. # cluster-announce-human-nodename ""
  1604. # Clusters can advertise how clients should connect to them using either their IP address,
  1605. # a user defined hostname, or by declaring they have no endpoint. Which endpoint is
  1606. # shown as the preferred endpoint is set by using the cluster-preferred-endpoint-type
  1607. # config with values 'ip', 'hostname', or 'unknown-endpoint'. This value controls how
  1608. # the endpoint returned for MOVED/ASKING requests as well as the first field of CLUSTER SLOTS.
  1609. # If the preferred endpoint type is set to hostname, but no announced hostname is set, a '?'
  1610. # will be returned instead.
  1611. #
  1612. # When a cluster advertises itself as having an unknown endpoint, it's indicating that
  1613. # the server doesn't know how clients can reach the cluster. This can happen in certain
  1614. # networking situations where there are multiple possible routes to the node, and the
  1615. # server doesn't know which one the client took. In this case, the server is expecting
  1616. # the client to reach out on the same endpoint it used for making the last request, but use
  1617. # the port provided in the response.
  1618. #
  1619. # cluster-preferred-endpoint-type ip
  1620. # In order to setup your cluster make sure to read the documentation
  1621. # available at https://redis.io web site.
  1622. ########################## CLUSTER DOCKER/NAT support ########################
  1623. # In certain deployments, Redis Cluster nodes address discovery fails, because
  1624. # addresses are NAT-ted or because ports are forwarded (the typical case is
  1625. # Docker and other containers).
  1626. #
  1627. # In order to make Redis Cluster working in such environments, a static
  1628. # configuration where each node knows its public address is needed. The
  1629. # following four options are used for this scope, and are:
  1630. #
  1631. # * cluster-announce-ip
  1632. # * cluster-announce-port
  1633. # * cluster-announce-tls-port
  1634. # * cluster-announce-bus-port
  1635. #
  1636. # Each instructs the node about its address, client ports (for connections
  1637. # without and with TLS) and cluster message bus port. The information is then
  1638. # published in the header of the bus packets so that other nodes will be able to
  1639. # correctly map the address of the node publishing the information.
  1640. #
  1641. # If tls-cluster is set to yes and cluster-announce-tls-port is omitted or set
  1642. # to zero, then cluster-announce-port refers to the TLS port. Note also that
  1643. # cluster-announce-tls-port has no effect if tls-cluster is set to no.
  1644. #
  1645. # If the above options are not used, the normal Redis Cluster auto-detection
  1646. # will be used instead.
  1647. #
  1648. # Note that when remapped, the bus port may not be at the fixed offset of
  1649. # clients port + 10000, so you can specify any port and bus-port depending
  1650. # on how they get remapped. If the bus-port is not set, a fixed offset of
  1651. # 10000 will be used as usual.
  1652. #
  1653. # Example:
  1654. #
  1655. # cluster-announce-ip 10.1.1.5
  1656. # cluster-announce-tls-port 6379
  1657. # cluster-announce-port 0
  1658. # cluster-announce-bus-port 6380
  1659. ################################## SLOW LOG ###################################
  1660. # The Redis Slow Log is a system to log queries that exceeded a specified
  1661. # execution time. The execution time does not include the I/O operations
  1662. # like talking with the client, sending the reply and so forth,
  1663. # but just the time needed to actually execute the command (this is the only
  1664. # stage of command execution where the thread is blocked and can not serve
  1665. # other requests in the meantime).
  1666. #
  1667. # You can configure the slow log with two parameters: one tells Redis
  1668. # what is the execution time, in microseconds, to exceed in order for the
  1669. # command to get logged, and the other parameter is the length of the
  1670. # slow log. When a new command is logged the oldest one is removed from the
  1671. # queue of logged commands.
  1672. # The following time is expressed in microseconds, so 1000000 is equivalent
  1673. # to one second. Note that a negative number disables the slow log, while
  1674. # a value of zero forces the logging of every command.
  1675. slowlog-log-slower-than 10000
  1676. # There is no limit to this length. Just be aware that it will consume memory.
  1677. # You can reclaim memory used by the slow log with SLOWLOG RESET.
  1678. slowlog-max-len 128
  1679. ################################ LATENCY MONITOR ##############################
  1680. # The Redis latency monitoring subsystem samples different operations
  1681. # at runtime in order to collect data related to possible sources of
  1682. # latency of a Redis instance.
  1683. #
  1684. # Via the LATENCY command this information is available to the user that can
  1685. # print graphs and obtain reports.
  1686. #
  1687. # The system only logs operations that were performed in a time equal or
  1688. # greater than the amount of milliseconds specified via the
  1689. # latency-monitor-threshold configuration directive. When its value is set
  1690. # to zero, the latency monitor is turned off.
  1691. #
  1692. # By default latency monitoring is disabled since it is mostly not needed
  1693. # if you don't have latency issues, and collecting data has a performance
  1694. # impact, that while very small, can be measured under big load. Latency
  1695. # monitoring can easily be enabled at runtime using the command
  1696. # "CONFIG SET latency-monitor-threshold <milliseconds>" if needed.
  1697. latency-monitor-threshold 0
  1698. ################################ LATENCY TRACKING ##############################
  1699. # The Redis extended latency monitoring tracks the per command latencies and enables
  1700. # exporting the percentile distribution via the INFO latencystats command,
  1701. # and cumulative latency distributions (histograms) via the LATENCY command.
  1702. #
  1703. # By default, the extended latency monitoring is enabled since the overhead
  1704. # of keeping track of the command latency is very small.
  1705. # latency-tracking yes
  1706. # By default the exported latency percentiles via the INFO latencystats command
  1707. # are the p50, p99, and p999.
  1708. # latency-tracking-info-percentiles 50 99 99.9
  1709. ############################# EVENT NOTIFICATION ##############################
  1710. # Redis can notify Pub/Sub clients about events happening in the key space.
  1711. # This feature is documented at https://redis.io/topics/notifications
  1712. #
  1713. # For instance if keyspace events notification is enabled, and a client
  1714. # performs a DEL operation on key "foo" stored in the Database 0, two
  1715. # messages will be published via Pub/Sub:
  1716. #
  1717. # PUBLISH __keyspace@0__:foo del
  1718. # PUBLISH __keyevent@0__:del foo
  1719. #
  1720. # It is possible to select the events that Redis will notify among a set
  1721. # of classes. Every class is identified by a single character:
  1722. #
  1723. # K Keyspace events, published with __keyspace@<db>__ prefix.
  1724. # E Keyevent events, published with __keyevent@<db>__ prefix.
  1725. # g Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ...
  1726. # $ String commands
  1727. # l List commands
  1728. # s Set commands
  1729. # h Hash commands
  1730. # z Sorted set commands
  1731. # x Expired events (events generated every time a key expires)
  1732. # e Evicted events (events generated when a key is evicted for maxmemory)
  1733. # n New key events (Note: not included in the 'A' class)
  1734. # t Stream commands
  1735. # d Module key type events
  1736. # m Key-miss events (Note: It is not included in the 'A' class)
  1737. # A Alias for g$lshzxetd, so that the "AKE" string means all the events
  1738. # (Except key-miss events which are excluded from 'A' due to their
  1739. # unique nature).
  1740. #
  1741. # The "notify-keyspace-events" takes as argument a string that is composed
  1742. # of zero or multiple characters. The empty string means that notifications
  1743. # are disabled.
  1744. #
  1745. # Example: to enable list and generic events, from the point of view of the
  1746. # event name, use:
  1747. #
  1748. # notify-keyspace-events Elg
  1749. #
  1750. # Example 2: to get the stream of the expired keys subscribing to channel
  1751. # name __keyevent@0__:expired use:
  1752. #
  1753. # notify-keyspace-events Ex
  1754. #
  1755. # By default all notifications are disabled because most users don't need
  1756. # this feature and the feature has some overhead. Note that if you don't
  1757. # specify at least one of K or E, no events will be delivered.
  1758. notify-keyspace-events ""
  1759. ############################### ADVANCED CONFIG ###############################
  1760. # Hashes are encoded using a memory efficient data structure when they have a
  1761. # small number of entries, and the biggest entry does not exceed a given
  1762. # threshold. These thresholds can be configured using the following directives.
  1763. hash-max-listpack-entries 512
  1764. hash-max-listpack-value 64
  1765. # Lists are also encoded in a special way to save a lot of space.
  1766. # The number of entries allowed per internal list node can be specified
  1767. # as a fixed maximum size or a maximum number of elements.
  1768. # For a fixed maximum size, use -5 through -1, meaning:
  1769. # -5: max size: 64 Kb <-- not recommended for normal workloads
  1770. # -4: max size: 32 Kb <-- not recommended
  1771. # -3: max size: 16 Kb <-- probably not recommended
  1772. # -2: max size: 8 Kb <-- good
  1773. # -1: max size: 4 Kb <-- good
  1774. # Positive numbers mean store up to _exactly_ that number of elements
  1775. # per list node.
  1776. # The highest performing option is usually -2 (8 Kb size) or -1 (4 Kb size),
  1777. # but if your use case is unique, adjust the settings as necessary.
  1778. list-max-listpack-size -2
  1779. # Lists may also be compressed.
  1780. # Compress depth is the number of quicklist ziplist nodes from *each* side of
  1781. # the list to *exclude* from compression. The head and tail of the list
  1782. # are always uncompressed for fast push/pop operations. Settings are:
  1783. # 0: disable all list compression
  1784. # 1: depth 1 means "don't start compressing until after 1 node into the list,
  1785. # going from either the head or tail"
  1786. # So: [head]->node->node->...->node->[tail]
  1787. # [head], [tail] will always be uncompressed; inner nodes will compress.
  1788. # 2: [head]->[next]->node->node->...->node->[prev]->[tail]
  1789. # 2 here means: don't compress head or head->next or tail->prev or tail,
  1790. # but compress all nodes between them.
  1791. # 3: [head]->[next]->[next]->node->node->...->node->[prev]->[prev]->[tail]
  1792. # etc.
  1793. list-compress-depth 0
  1794. # Sets have a special encoding when a set is composed
  1795. # of just strings that happen to be integers in radix 10 in the range
  1796. # of 64 bit signed integers.
  1797. # The following configuration setting sets the limit in the size of the
  1798. # set in order to use this special memory saving encoding.
  1799. set-max-intset-entries 512
  1800. # Sets containing non-integer values are also encoded using a memory efficient
  1801. # data structure when they have a small number of entries, and the biggest entry
  1802. # does not exceed a given threshold. These thresholds can be configured using
  1803. # the following directives.
  1804. set-max-listpack-entries 128
  1805. set-max-listpack-value 64
  1806. # Similarly to hashes and lists, sorted sets are also specially encoded in
  1807. # order to save a lot of space. This encoding is only used when the length and
  1808. # elements of a sorted set are below the following limits:
  1809. zset-max-listpack-entries 128
  1810. zset-max-listpack-value 64
  1811. # HyperLogLog sparse representation bytes limit. The limit includes the
  1812. # 16 bytes header. When a HyperLogLog using the sparse representation crosses
  1813. # this limit, it is converted into the dense representation.
  1814. #
  1815. # A value greater than 16000 is totally useless, since at that point the
  1816. # dense representation is more memory efficient.
  1817. #
  1818. # The suggested value is ~ 3000 in order to have the benefits of
  1819. # the space efficient encoding without slowing down too much PFADD,
  1820. # which is O(N) with the sparse encoding. The value can be raised to
  1821. # ~ 10000 when CPU is not a concern, but space is, and the data set is
  1822. # composed of many HyperLogLogs with cardinality in the 0 - 15000 range.
  1823. hll-sparse-max-bytes 3000
  1824. # Streams macro node max size / items. The stream data structure is a radix
  1825. # tree of big nodes that encode multiple items inside. Using this configuration
  1826. # it is possible to configure how big a single node can be in bytes, and the
  1827. # maximum number of items it may contain before switching to a new node when
  1828. # appending new stream entries. If any of the following settings are set to
  1829. # zero, the limit is ignored, so for instance it is possible to set just a
  1830. # max entries limit by setting max-bytes to 0 and max-entries to the desired
  1831. # value.
  1832. stream-node-max-bytes 4096
  1833. stream-node-max-entries 100
  1834. # Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
  1835. # order to help rehashing the main Redis hash table (the one mapping top-level
  1836. # keys to values). The hash table implementation Redis uses (see dict.c)
  1837. # performs a lazy rehashing: the more operation you run into a hash table
  1838. # that is rehashing, the more rehashing "steps" are performed, so if the
  1839. # server is idle the rehashing is never complete and some more memory is used
  1840. # by the hash table.
  1841. #
  1842. # The default is to use this millisecond 10 times every second in order to
  1843. # actively rehash the main dictionaries, freeing memory when possible.
  1844. #
  1845. # If unsure:
  1846. # use "activerehashing no" if you have hard latency requirements and it is
  1847. # not a good thing in your environment that Redis can reply from time to time
  1848. # to queries with 2 milliseconds delay.
  1849. #
  1850. # use "activerehashing yes" if you don't have such hard requirements but
  1851. # want to free memory asap when possible.
  1852. activerehashing yes
  1853. # The client output buffer limits can be used to force disconnection of clients
  1854. # that are not reading data from the server fast enough for some reason (a
  1855. # common reason is that a Pub/Sub client can't consume messages as fast as the
  1856. # publisher can produce them).
  1857. #
  1858. # The limit can be set differently for the three different classes of clients:
  1859. #
  1860. # normal -> normal clients including MONITOR clients
  1861. # replica -> replica clients
  1862. # pubsub -> clients subscribed to at least one pubsub channel or pattern
  1863. #
  1864. # The syntax of every client-output-buffer-limit directive is the following:
  1865. #
  1866. # client-output-buffer-limit <class> <hard limit> <soft limit> <soft seconds>
  1867. #
  1868. # A client is immediately disconnected once the hard limit is reached, or if
  1869. # the soft limit is reached and remains reached for the specified number of
  1870. # seconds (continuously).
  1871. # So for instance if the hard limit is 32 megabytes and the soft limit is
  1872. # 16 megabytes / 10 seconds, the client will get disconnected immediately
  1873. # if the size of the output buffers reach 32 megabytes, but will also get
  1874. # disconnected if the client reaches 16 megabytes and continuously overcomes
  1875. # the limit for 10 seconds.
  1876. #
  1877. # By default normal clients are not limited because they don't receive data
  1878. # without asking (in a push way), but just after a request, so only
  1879. # asynchronous clients may create a scenario where data is requested faster
  1880. # than it can read.
  1881. #
  1882. # Instead there is a default limit for pubsub and replica clients, since
  1883. # subscribers and replicas receive data in a push fashion.
  1884. #
  1885. # Note that it doesn't make sense to set the replica clients output buffer
  1886. # limit lower than the repl-backlog-size config (partial sync will succeed
  1887. # and then replica will get disconnected).
  1888. # Such a configuration is ignored (the size of repl-backlog-size will be used).
  1889. # This doesn't have memory consumption implications since the replica client
  1890. # will share the backlog buffers memory.
  1891. #
  1892. # Both the hard or the soft limit can be disabled by setting them to zero.
  1893. client-output-buffer-limit normal 0 0 0
  1894. client-output-buffer-limit replica 256mb 64mb 60
  1895. client-output-buffer-limit pubsub 32mb 8mb 60
  1896. # Client query buffers accumulate new commands. They are limited to a fixed
  1897. # amount by default in order to avoid that a protocol desynchronization (for
  1898. # instance due to a bug in the client) will lead to unbound memory usage in
  1899. # the query buffer. However you can configure it here if you have very special
  1900. # needs, such us huge multi/exec requests or alike.
  1901. #
  1902. # client-query-buffer-limit 1gb
  1903. # In some scenarios client connections can hog up memory leading to OOM
  1904. # errors or data eviction. To avoid this we can cap the accumulated memory
  1905. # used by all client connections (all pubsub and normal clients). Once we
  1906. # reach that limit connections will be dropped by the server freeing up
  1907. # memory. The server will attempt to drop the connections using the most
  1908. # memory first. We call this mechanism "client eviction".
  1909. #
  1910. # Client eviction is configured using the maxmemory-clients setting as follows:
  1911. # 0 - client eviction is disabled (default)
  1912. #
  1913. # A memory value can be used for the client eviction threshold,
  1914. # for example:
  1915. # maxmemory-clients 1g
  1916. #
  1917. # A percentage value (between 1% and 100%) means the client eviction threshold
  1918. # is based on a percentage of the maxmemory setting. For example to set client
  1919. # eviction at 5% of maxmemory:
  1920. # maxmemory-clients 5%
  1921. # In the Redis protocol, bulk requests, that are, elements representing single
  1922. # strings, are normally limited to 512 mb. However you can change this limit
  1923. # here, but must be 1mb or greater
  1924. #
  1925. # proto-max-bulk-len 512mb
  1926. # Redis calls an internal function to perform many background tasks, like
  1927. # closing connections of clients in timeout, purging expired keys that are
  1928. # never requested, and so forth.
  1929. #
  1930. # Not all tasks are performed with the same frequency, but Redis checks for
  1931. # tasks to perform according to the specified "hz" value.
  1932. #
  1933. # By default "hz" is set to 10. Raising the value will use more CPU when
  1934. # Redis is idle, but at the same time will make Redis more responsive when
  1935. # there are many keys expiring at the same time, and timeouts may be
  1936. # handled with more precision.
  1937. #
  1938. # The range is between 1 and 500, however a value over 100 is usually not
  1939. # a good idea. Most users should use the default of 10 and raise this up to
  1940. # 100 only in environments where very low latency is required.
  1941. hz 10
  1942. # Normally it is useful to have an HZ value which is proportional to the
  1943. # number of clients connected. This is useful in order, for instance, to
  1944. # avoid too many clients are processed for each background task invocation
  1945. # in order to avoid latency spikes.
  1946. #
  1947. # Since the default HZ value by default is conservatively set to 10, Redis
  1948. # offers, and enables by default, the ability to use an adaptive HZ value
  1949. # which will temporarily raise when there are many connected clients.
  1950. #
  1951. # When dynamic HZ is enabled, the actual configured HZ will be used
  1952. # as a baseline, but multiples of the configured HZ value will be actually
  1953. # used as needed once more clients are connected. In this way an idle
  1954. # instance will use very little CPU time while a busy instance will be
  1955. # more responsive.
  1956. dynamic-hz yes
  1957. # When a child rewrites the AOF file, if the following option is enabled
  1958. # the file will be fsync-ed every 4 MB of data generated. This is useful
  1959. # in order to commit the file to the disk more incrementally and avoid
  1960. # big latency spikes.
  1961. aof-rewrite-incremental-fsync yes
  1962. # When redis saves RDB file, if the following option is enabled
  1963. # the file will be fsync-ed every 4 MB of data generated. This is useful
  1964. # in order to commit the file to the disk more incrementally and avoid
  1965. # big latency spikes.
  1966. rdb-save-incremental-fsync yes
  1967. # Redis LFU eviction (see maxmemory setting) can be tuned. However it is a good
  1968. # idea to start with the default settings and only change them after investigating
  1969. # how to improve the performances and how the keys LFU change over time, which
  1970. # is possible to inspect via the OBJECT FREQ command.
  1971. #
  1972. # There are two tunable parameters in the Redis LFU implementation: the
  1973. # counter logarithm factor and the counter decay time. It is important to
  1974. # understand what the two parameters mean before changing them.
  1975. #
  1976. # The LFU counter is just 8 bits per key, it's maximum value is 255, so Redis
  1977. # uses a probabilistic increment with logarithmic behavior. Given the value
  1978. # of the old counter, when a key is accessed, the counter is incremented in
  1979. # this way:
  1980. #
  1981. # 1. A random number R between 0 and 1 is extracted.
  1982. # 2. A probability P is calculated as 1/(old_value*lfu_log_factor+1).
  1983. # 3. The counter is incremented only if R < P.
  1984. #
  1985. # The default lfu-log-factor is 10. This is a table of how the frequency
  1986. # counter changes with a different number of accesses with different
  1987. # logarithmic factors:
  1988. #
  1989. # +--------+------------+------------+------------+------------+------------+
  1990. # | factor | 100 hits | 1000 hits | 100K hits | 1M hits | 10M hits |
  1991. # +--------+------------+------------+------------+------------+------------+
  1992. # | 0 | 104 | 255 | 255 | 255 | 255 |
  1993. # +--------+------------+------------+------------+------------+------------+
  1994. # | 1 | 18 | 49 | 255 | 255 | 255 |
  1995. # +--------+------------+------------+------------+------------+------------+
  1996. # | 10 | 10 | 18 | 142 | 255 | 255 |
  1997. # +--------+------------+------------+------------+------------+------------+
  1998. # | 100 | 8 | 11 | 49 | 143 | 255 |
  1999. # +--------+------------+------------+------------+------------+------------+
  2000. #
  2001. # NOTE: The above table was obtained by running the following commands:
  2002. #
  2003. # redis-benchmark -n 1000000 incr foo
  2004. # redis-cli object freq foo
  2005. #
  2006. # NOTE 2: The counter initial value is 5 in order to give new objects a chance
  2007. # to accumulate hits.
  2008. #
  2009. # The counter decay time is the time, in minutes, that must elapse in order
  2010. # for the key counter to be decremented.
  2011. #
  2012. # The default value for the lfu-decay-time is 1. A special value of 0 means we
  2013. # will never decay the counter.
  2014. #
  2015. # lfu-log-factor 10
  2016. # lfu-decay-time 1
  2017. ########################### ACTIVE DEFRAGMENTATION #######################
  2018. #
  2019. # What is active defragmentation?
  2020. # -------------------------------
  2021. #
  2022. # Active (online) defragmentation allows a Redis server to compact the
  2023. # spaces left between small allocations and deallocations of data in memory,
  2024. # thus allowing to reclaim back memory.
  2025. #
  2026. # Fragmentation is a natural process that happens with every allocator (but
  2027. # less so with Jemalloc, fortunately) and certain workloads. Normally a server
  2028. # restart is needed in order to lower the fragmentation, or at least to flush
  2029. # away all the data and create it again. However thanks to this feature
  2030. # implemented by Oran Agra for Redis 4.0 this process can happen at runtime
  2031. # in a "hot" way, while the server is running.
  2032. #
  2033. # Basically when the fragmentation is over a certain level (see the
  2034. # configuration options below) Redis will start to create new copies of the
  2035. # values in contiguous memory regions by exploiting certain specific Jemalloc
  2036. # features (in order to understand if an allocation is causing fragmentation
  2037. # and to allocate it in a better place), and at the same time, will release the
  2038. # old copies of the data. This process, repeated incrementally for all the keys
  2039. # will cause the fragmentation to drop back to normal values.
  2040. #
  2041. # Important things to understand:
  2042. #
  2043. # 1. This feature is disabled by default, and only works if you compiled Redis
  2044. # to use the copy of Jemalloc we ship with the source code of Redis.
  2045. # This is the default with Linux builds.
  2046. #
  2047. # 2. You never need to enable this feature if you don't have fragmentation
  2048. # issues.
  2049. #
  2050. # 3. Once you experience fragmentation, you can enable this feature when
  2051. # needed with the command "CONFIG SET activedefrag yes".
  2052. #
  2053. # The configuration parameters are able to fine tune the behavior of the
  2054. # defragmentation process. If you are not sure about what they mean it is
  2055. # a good idea to leave the defaults untouched.
  2056. # Active defragmentation is disabled by default
  2057. # activedefrag no
  2058. # Minimum amount of fragmentation waste to start active defrag
  2059. # active-defrag-ignore-bytes 100mb
  2060. # Minimum percentage of fragmentation to start active defrag
  2061. # active-defrag-threshold-lower 10
  2062. # Maximum percentage of fragmentation at which we use maximum effort
  2063. # active-defrag-threshold-upper 100
  2064. # Minimal effort for defrag in CPU percentage, to be used when the lower
  2065. # threshold is reached
  2066. # active-defrag-cycle-min 1
  2067. # Maximal effort for defrag in CPU percentage, to be used when the upper
  2068. # threshold is reached
  2069. # active-defrag-cycle-max 25
  2070. # Maximum number of set/hash/zset/list fields that will be processed from
  2071. # the main dictionary scan
  2072. # active-defrag-max-scan-fields 1000
  2073. # Jemalloc background thread for purging will be enabled by default
  2074. jemalloc-bg-thread yes
  2075. # It is possible to pin different threads and processes of Redis to specific
  2076. # CPUs in your system, in order to maximize the performances of the server.
  2077. # This is useful both in order to pin different Redis threads in different
  2078. # CPUs, but also in order to make sure that multiple Redis instances running
  2079. # in the same host will be pinned to different CPUs.
  2080. #
  2081. # Normally you can do this using the "taskset" command, however it is also
  2082. # possible to this via Redis configuration directly, both in Linux and FreeBSD.
  2083. #
  2084. # You can pin the server/IO threads, bio threads, aof rewrite child process, and
  2085. # the bgsave child process. The syntax to specify the cpu list is the same as
  2086. # the taskset command:
  2087. #
  2088. # Set redis server/io threads to cpu affinity 0,2,4,6:
  2089. # server_cpulist 0-7:2
  2090. #
  2091. # Set bio threads to cpu affinity 1,3:
  2092. # bio_cpulist 1,3
  2093. #
  2094. # Set aof rewrite child process to cpu affinity 8,9,10,11:
  2095. # aof_rewrite_cpulist 8-11
  2096. #
  2097. # Set bgsave child process to cpu affinity 1,10,11
  2098. # bgsave_cpulist 1,10-11
  2099. # In some cases redis will emit warnings and even refuse to start if it detects
  2100. # that the system is in bad state, it is possible to suppress these warnings
  2101. # by setting the following config which takes a space delimited list of warnings
  2102. # to suppress
  2103. #
  2104. # ignore-warnings ARM64-COW-BUG