redis.conf.j2 40 KB

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