Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

CONFIG SET

Last updated
CONFIG SET parameter value [parameter value ...]
Group
Server
Complexity
O(N) where N is the number of settings given
Arity
-4 (at least 4 words, counting the command name)
HotKV Cloud
All plans
On-Premise
no license needed

CONFIG SET changes settings on the running server. The new values take effect at once, but they are not written to the config file: run CONFIG REWRITE to keep them across a restart. Names are case-insensitive, and the older names Redis accepts (such as slave-read-only or lua-time-limit) work too.

Values are checked the way Redis checks them: yes/no settings take yes or no, whole-number settings refuse fractions and trailing text, and memory settings take bytes or a unit (100mb, 1gb).

Most settings can, including maxmemory, maxmemory-policy, timeout, maxclients, save, appendonly, appendfsync, notify-keyspace-events, slowlog-log-slower-than, latency-monitor-threshold, requirepass, protected-mode, bind, port, tls-port, the encoding size settings (hash-max-listpack-entries and the like) and the tls-* certificate and key files. A few have side effects worth knowing:

  • appendonly yes opens the append-only file and starts a rewrite, so the file holds the whole data set and not only later writes.
  • Setting any TLS certificate or key file reloads TLS for new connections, even if the path is unchanged, so a renewed certificate takes effect without a restart. If the new files cannot be loaded, the TLS settings are restored and the command fails.
  • bind and port move the listeners at once, or keep the old ones if the new address cannot be used.
  • requirepass also changes the password of the ACL default user.

These need a restart and are refused with parameter '<name>' cannot be changed at runtime (requires restart): tcp-backlog, threads, databases, daemonize, logfile, appenddirname, metrics-port, tls-bind, tls-replication, enable-protected-configs, enable-debug-command. (tls-cluster can be changed: bus connections made afterwards follow it.)

cluster-enabled, cluster-config-file, cluster-port, cluster-databases, pidfile, aclfile, replicaof and slaveof are refused with can't set immutable config.

dir, dbfilename and appendfilename are protected, as in Redis 7: they can only be set when enable-protected-configs is yes, or local and the command comes from a loopback connection. Otherwise they are refused with can't set protected config.

Simple string OK when every setting was applied, in RESP2 and RESP3.

Case Error
A value is refused ERR CONFIG SET failed (possibly related to argument '<name>') - <reason>
The same setting given twice ERR CONFIG SET failed (possibly related to argument '<name>') - duplicate parameter
Unknown setting ERR Unknown option or number of arguments for CONFIG SET - '<name>'
Bad appendfsync value ERR Invalid appendfsync value '<value>'
Odd number of arguments ERR wrong number of arguments for 'config|set' command
TLS files that cannot be loaded ERR Unable to update TLS configuration: <reason>

Settings are applied in the order given. If one of several is refused, the ones before it stay applied; nothing after it is applied.

127.0.0.1:6379> CONFIG SET maxmemory 2gb maxmemory-policy allkeys-lru
OK
127.0.0.1:6379> CONFIG GET maxmemory
1) "maxmemory"
2) "2147483648"
127.0.0.1:6379> CONFIG SET maxmemory-samples 100
(error) ERR CONFIG SET failed (possibly related to argument 'maxmemory-samples') - argument must be between 1 and 64 inclusive
127.0.0.1:6379> CONFIG SET databases 32
(error) ERR CONFIG SET failed (possibly related to argument 'databases') - parameter 'databases' cannot be changed at runtime (requires restart)
127.0.0.1:6379> CONFIG SET dir /tmp
(error) ERR CONFIG SET failed (possibly related to argument 'dir') - can't set protected config

In HotKV Cloud, the CLI tab of the panel does not run CONFIG SET. Use the instance’s Configuration tab for the settings it offers, or your own client connection. maxmemory follows your plan.

Same syntax and error format as Redis 7 and Valkey 8. Differences: Redis 7 applies a multi-setting CONFIG SET all or nothing, while HotKV keeps the settings applied before a refused one; and HotKV has settings of its own (such as threads and compression-enabled), while Redis settings that HotKV does not implement are refused as unknown.

CONFIG GET, CONFIG REWRITE, configuration reference