328 Commits

Author SHA1 Message Date
Yossi Gottlieb
f0e28abc07 Add oom-score-adj configuration option to control Linux OOM killer. (#1690)
Add Linux kernel OOM killer control option.

This adds the ability to control the Linux OOM killer oom_score_adj
parameter for all Redis processes, depending on the process role (i.e.
master, replica, background child).

A oom-score-adj global boolean flag control this feature. In addition,
specific values can be configured using oom-score-adj-values if
additional tuning is required.

(cherry picked from commit 70c823a64e800f22ac68f0172acdd1da82d7be32)
2020-09-01 09:27:58 +03:00
Yossi Gottlieb
3ed7d0af20 TLS: relax verification on CONFIG SET. (#7665)
Avoid re-configuring (and validating) SSL/TLS configuration on `CONFIG
SET` when TLS is not actively enabled for incoming connections, cluster
bus or replication.

This fixes failures when tests run without `--tls` on binaries that were
built with TLS support.

An additional benefit is that it's now possible to perform a multi-step
configuration process while TLS is disabled. The new configuration will
be verified and applied only when TLS is effectively enabled.

(cherry picked from commit 24efd22e894c90f380aa05a5fa77134bb9423ad3)
2020-09-01 09:27:58 +03:00
zhaozhao.zz
f0f4ef4423 config: proto-max-bulk-len must be 1mb or greater
(cherry picked from commit 46323cec56793c66273005b72f1f29146c108840)
2020-09-01 09:27:58 +03:00
Wang Yuan
753ff31fa3 Print error info if failed opening config file (#6943)
(cherry picked from commit 514a1e223df5b62cd1fc6aff38126d4a74ebef7e)
2020-09-01 09:27:58 +03:00
Jiayuan Chen
7b2af98316 Add optional tls verification (#7502)
Adds an `optional` value to the previously boolean `tls-auth-clients` configuration keyword.

Co-authored-by: Yossi Gottlieb <yossigo@gmail.com>
(cherry picked from commit 198770751fdc4c46eb4971ead9b5787fd6ce39fd)
2020-09-01 09:27:58 +03:00
Yossi Gottlieb
ba559dc903 TLS: support cluster/replication without tls-port.
Initialize and configure OpenSSL even when tls-port is not used, because
we may still have tls-cluster or tls-replication.

Also, make sure to reconfigure OpenSSL when these parameters are changed
as TLS could have been enabled for the first time.

(cherry picked from commit b76a93c362091daafd8a8d15a45d527b7437d013)
2020-09-01 09:27:58 +03:00
Yossi Gottlieb
27d44fbf73 TLS: Session caching configuration support. (#7420)
* TLS: Session caching configuration support.
* TLS: Remove redundant config initialization.

(cherry picked from commit c611a836f630ecf358b5cfb0d3c5e21c9f0bc105)
2020-07-20 21:08:26 +03:00
zhenwei pi
1a632b6964 Support setcpuaffinity on linux/bsd
Currently, there are several types of threads/child processes of a
redis server. Sometimes we need deeply optimise the performance of
redis, so we would like to isolate threads/processes.

There were some discussion about cpu affinity cases in the issue:
https://github.com/antirez/redis/issues/2863

So implement cpu affinity setting by redis.conf in this patch, then
we can config server_cpulist/bio_cpulist/aof_rewrite_cpulist/
bgsave_cpulist by cpu list.

Examples of cpulist in redis.conf:
server_cpulist 0-7:2      means cpu affinity 0,2,4,6
bio_cpulist 1,3           means cpu affinity 1,3
aof_rewrite_cpulist 8-11  means cpu affinity 8,9,10,11
bgsave_cpulist 1,10-11    means cpu affinity 1,10,11

Test on linux/freebsd, both work fine.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2020-05-08 10:37:35 +02:00
zhaozhao.zz
73e7bcc598 lazyfree: add a new configuration lazyfree-lazy-user-del
Delete keys in async way when executing DEL command, if
lazyfree-lazy-user-del is yes.
2020-04-07 16:53:13 +02:00
antirez
d9f9a29afa ACL: Make Redis 6 more backward compatible with requirepass.
Note that this as a side effect fixes Sentinel "requirepass" mode.
2020-03-25 15:54:34 +01:00
antirez
749a4e962a Make sync RDB deletion configurable. Default to no. 2020-03-05 12:51:15 +01:00
antirez
c1951137bb Show Redis version when not understanding a config directive.
This makes simpler to give people help when posting such kind of errors
in the mailing list or other help forums, because sometimes the
directive looks well spelled, but the version of Redis they are using is
not able to support it.
2020-03-05 12:51:14 +01:00
antirez
b977f87438 Fix SDS misuse in enumConfigSet(). Related to #6778. 2020-02-27 18:02:30 +01:00
antirez
310a80764d Remove useless comment from enumConfigSet(). 2020-02-27 18:02:30 +01:00
Ponnuvel Palaniyappan
3af14cfa3d Fix a potential overflow with strncpy 2020-02-27 18:02:30 +01:00
antirez
a227fd7cca Tracking: fix max-keys configuration directive. 2020-02-27 18:00:46 +01:00
antirez
ddc4965ac5 Tracking: minor change of names and new INFO field. 2020-02-27 17:59:57 +01:00
Oran Agra
da8ec22fc6 Memory leak when bind config is provided twice 2020-02-12 14:17:40 +01:00
Oran Agra
600d02e1a7 fix maxmemory config warning
the warning condition was if usage > limit (saying it'll cause eviction
or oom), but in fact the eviction and oom depends on used minus slave
buffers.

other than fixing the condition, i add info about the current usage and
limit, which may be useful when looking at the log.
2020-02-12 14:17:40 +01:00
Oran Agra
601d423498 config.c verbose error replies for CONFIG SET, like config file parsing
We noticed that the error replies for the generic mechanism for enums
are very verbose for config file parsing, but not for config set
command.

instead of replicating this code, i did a small refactoring to share
code between CONFIG SET and config file parsing.

and also renamed the enum group functions to be consistent with the
naming of other types.
2020-02-12 14:15:56 +01:00
antirez
491949ee5b ACL LOG: make max log entries configurable. 2020-02-12 14:15:35 +01:00
WuYunlong
7030e66807 Fix petential cluster link error.
Funcion adjustOpenFilesLimit() has an implicit parameter, which is server.maxclients.
This function aims to ajust maximum file descriptor number according to server.maxclients
by best effort, which is "bestlimit" could be lower than "maxfiles" but greater than "oldlimit".
When we try to increase "maxclients" using CONFIG SET command, we could increase maximum
file descriptor number to a bigger value without calling aeResizeSetSize the same time.
When later more and more clients connect to server, the allocated fd could be bigger and bigger,
and eventually exceeds events size of aeEventLoop.events. When new nodes joins the cluster,
new link is created, together with new fd, but when calling aeCreateFileEvent, we did not
check the return value. In this case, we have a non-null "link" but the associated fd is not
registered.

So when we dynamically set "maxclients" we could reach an inconsistency between maximum file
descriptor number of the process and server.maxclients. And later could cause cluster link and link
fd inconsistency.

While setting "maxclients" dynamically, we consider it as failed when resulting "maxclients" is not
the same as expected. We try to restore back the maximum file descriptor number when we failed to set
"maxclients" to the specified value, so that server.maxclients could act as a guard as before.
2020-01-10 13:16:14 +01:00
Itamar Haber
d6a6b6f40c Adjusts 'io_threads_num' max to 128
Instead of 512, use the defined max from networking.c
2020-01-10 13:16:03 +01:00
Oran Agra
f866b31a74 config.c adjust config limits and mutable
- make lua-replicate-commands mutable (it never was, but i don't see why)
- make tcp-backlog immutable (fix a recent refactory mistake)
- increase the max limit of a few configs to match what they were before
the recent refactory
2019-12-29 15:46:31 +01:00
Madelyn Olson
2d2f4ee475 Resolved merge miss 2019-12-16 23:40:19 -08:00
Madelyn Olson
d9c79ff75c Add configuration option for allowing reads on cluster down 2019-12-16 23:33:16 -08:00
Oran Agra
015136bf06 config.c post refactory cleanup 2019-12-01 08:19:25 +02:00
Oran Agra
493cc493b6 Converting more configs to use generic infra, and moving defaults to config.c
Changes in behavior:
- Change server.stream_node_max_entries from int64_t to long long, so that it can be used by the generic infra
- standard error reply instead of "repl-backlog-size must be 1 or greater" and such
- tls-port and a few TLS booleans were readable (config get) even when USE_OPENSSL was off (now they aren't)
- syslog-enabled, syslog-ident, cluster-enabled, appendfilename, and supervised didn't have a get (now they do)
- pidfile was initialized to NULL in InitServerConfig but had CONFIG_DEFAULT_PID_FILE in rewriteConfig (so the real default was "", but rewrite would cause it to be set), fixed the rewrite.
- TLS config in server.h was uninitialized (if no tls config args were provided)

Adding test for sanity and coverage
2019-11-28 11:24:57 +02:00
Oran Agra
0462896e15 More improvements and fixes to generic config infra
- Adding is_valid_fn and update_fn, both return 1 for success and 0 for failure with an optional error message.
- Bugfix in handling boundary check of unsigned numeric types (was boundaries as signed)
- Adding more numeric types to generic mechanism: uint, ulonglong, long, time_t, off_t
- More verbose error replies ("argument must be between" in out of range CONFIG SET (like config file parsing)
2019-11-28 11:11:07 +02:00
Oran Agra
82e997c043 Additional config.c refactory and bugfixes
- add capability for each config to have a callback to check if value is valid and return error string
  will enable converting many of the remaining custom configs into generic ones (reducing the x4 repetition for set,get,config,rewrite)
- add capability for each config to  to run some update code after config is changed (only for CONFIG SET)
  will also enable converting many of the remaining custom configs into generic ones
- add capability to move default values from server.h and server.c to config.c
  will reduce many excess lines in server.h and server.c (plus, no need to rebuild the entire code base when a default change 8-))

other behavior changes:
- fix bug in bool config get (always returning 'yes')
- fix a bug in modifying jemalloc-bg-thread at runtime (didn't call set_jemalloc_bg_thread, due to bad merge conflict resolution (my fault))
- side effect when a failed attempt to enable activedefrag at runtime, we now respond with -ERR and not with -DISABLED
2019-11-26 16:52:28 +02:00
antirez
b7d9ef6033 config.c: remove trailing spaces, trim comments to 80 cols. 2019-11-22 17:54:22 +01:00
Madelyn Olson
678cf14f4a Changed a tab to a space 2019-11-22 06:44:12 +00:00
Madelyn Olson
c0891d5cca Fixed a bug with enum log printing 2019-11-22 06:28:50 +00:00
Madelyn Olson
1f35b8ce05 Fixed some linux warnings 2019-11-22 05:49:52 +00:00
Madelyn Olson
d57a2b9ef2 Added a flag for strings that are stored as NULL 2019-11-21 21:31:53 -08:00
Madelyn Olson
faeed15627 Refactored renaming types in config 2019-11-20 09:22:38 -08:00
antirez
c7d07138c7 Expire cycle: make expire effort configurable. 2019-11-18 11:33:44 +01:00
Yossi Gottlieb
85d7f38136 Merge remote-tracking branch 'upstream/unstable' into tls 2019-10-16 17:08:07 +03:00
Yossi Gottlieb
514e5aa8ef TLS: Improve CA certifiate configuration options.
This adds support for explicit configuration of a CA certs directory (in
addition to the previously supported bundle file).  For redis-cli, if no
explicit CA configuration is supplied the system-wide default
configuration will be adopted.
2019-10-08 17:58:50 +03:00
Yossi Gottlieb
df08b624bd TLS: Configuration options.
Add configuration options for TLS protocol versions, ciphers/cipher
suites selection, etc.
2019-10-07 21:07:27 +03:00
Oran Agra
6fd5ff8c98 diskless replication rdb transfer uses pipe, and writes to sockets form the parent process.
misc:
- handle SSL_has_pending by iterating though these in beforeSleep, and setting timeout of 0 to aeProcessEvents
- fix issue with epoll signaling EPOLLHUP and EPOLLERR only to the write handlers. (needed to detect the rdb pipe was closed)
- add key-load-delay config for testing
- trim connShutdown which is no longer needed
- rioFdsetWrite -> rioFdWrite - simplified since there's no longer need to write to multiple FDs
- don't detect rdb child exited (don't call wait3) until we detect the pipe is closed
- Cleanup bad optimization from rio.c, add another one
2019-10-07 21:06:30 +03:00
Yossi Gottlieb
10ffeb03e4 TLS: Connections refactoring and TLS support.
* Introduce a connection abstraction layer for all socket operations and
integrate it across the code base.
* Provide an optional TLS connections implementation based on OpenSSL.
* Pull a newer version of hiredis with TLS support.
* Tests, redis-cli updates for TLS support.
2019-10-07 21:06:13 +03:00
Oran Agra
7737e5814a Merge remote-tracking branch 'antirez/unstable' into jemalloc_purge_bg 2019-10-04 13:53:40 +03:00
Salvatore Sanfilippo
14a50854cc Merge pull request #6308 from oranagra/repl-diskless-load-config
fix error handling on config parsing of repl-diskless-load
2019-10-04 11:56:08 +02:00
antirez
31a20f0fbb Make config.c always_replicate_commands more uniform.
Better if it resembles the other similar code paths.
2019-09-20 11:46:35 +02:00
antirez
e7444fde2d Remove redundant statement in config.c.
Thanks to @guybe7 for spotting the error in the original PR I merged.
2019-09-20 11:44:32 +02:00
WuYunlong
dd077faf49 Fix bad handling of unexpected option while loading config "lua-replicate-commands". 2019-09-20 08:14:36 +08:00
Oran Agra
f1c8492bca fix error handling on config parsing of repl-diskless-load 2019-08-08 14:53:36 +03:00
antirez
d427b312ea Merge branch 'unstable' of github.com:/antirez/redis into unstable 2019-07-24 11:45:19 +02:00
antirez
83b8fbf580 Client side caching: config option for table fill rate. 2019-07-24 11:35:01 +02:00