CONFIG REWRITE
CONFIG REWRITE
- Group
- Server
- Arity
- 2 (exactly, counting the command name)
- HotKV Cloud
- All plans
- On-Premise
- no license needed
CONFIG REWRITE saves the settings changed with
CONFIG SET to the config file the server was started
with, so they survive a restart. Only settings whose running value differs
from what the file says are written. Lines the server does not recognise,
and the rest of the file, are left as they are.
Both config file formats work: a Redis-style .conf file and a .toml
file. A TOML file is checked before it is written, and left unchanged if the
result would not parse.
Return value
Section titled “Return value”| Case | Reply (RESP2 and RESP3) |
|---|---|
| File written | Simple string OK |
| Server started without a config file | Error ERR The server is running without a config file |
| File could not be written | Error ERR Rewriting config file failed, check server logs |
Examples
Section titled “Examples”127.0.0.1:6379> CONFIG SET slowlog-log-slower-than 5000OK127.0.0.1:6379> CONFIG REWRITEOKIn HotKV Cloud, the CLI tab of the panel does not run CONFIG REWRITE. Run
it from your own client connection.
Compatibility
Section titled “Compatibility”Same replies as Redis 7 and Valkey 8. Redis rewrites only .conf files;
HotKV also rewrites TOML config files.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.