Persists the effective configuration to file.
CONFIG
REWRITE
The CONFIG REWRITE
command rewrites the
valkey.conf
file the server was started with, applying the
minimal changes needed to make it reflect the configuration currently
used by the server, which may be different compared to the original one
because of the use of the CONFIG SET
command.
The rewrite is performed in a very conservative way:
save
directives, but the current configuration has
fewer or none as you disabled RDB persistence, all the lines will be
blanked.CONFIG REWRITE is also able to rewrite the configuration file from scratch if the original one no longer exists for some reason. However if the server was started without a configuration file at all, the CONFIG REWRITE will just return an error.
In order to make sure the valkey.conf file is always consistent, that
is, on errors or crashes you always end with the old file, or the new
one, the rewrite is performed with a single write(2)
call
that has enough content to be at least as big as the old file. Sometimes
additional padding in the form of comments is added in order to make
sure the resulting file is big enough, and later the file gets truncated
to remove the padding at the end.
Simple string
reply: OK
when the configuration was rewritten
properly. Otherwise an error is returned.
O(1)
@admin @dangerous @slow
ACL, ACL CAT, ACL DELUSER, ACL DRYRUN, ACL GENPASS, ACL GETUSER, ACL HELP, ACL LIST, ACL LOAD, ACL LOG, ACL SAVE, ACL SETUSER, ACL USERS, ACL WHOAMI, BGREWRITEAOF, BGSAVE, COMMAND, COMMAND COUNT, COMMAND DOCS, COMMAND GETKEYS, COMMAND GETKEYSANDFLAGS, COMMAND HELP, COMMAND INFO, COMMAND LIST, CONFIG, CONFIG GET, CONFIG HELP, CONFIG RESETSTAT, CONFIG SET, DBSIZE, DEBUG, FAILOVER, FLUSHALL, FLUSHDB, INFO, LASTSAVE, LATENCY, LATENCY DOCTOR, LATENCY GRAPH, LATENCY HELP, LATENCY HISTOGRAM, LATENCY HISTORY, LATENCY LATEST, LATENCY RESET, LOLWUT, MEMORY, MEMORY DOCTOR, MEMORY HELP, MEMORY MALLOC-STATS, MEMORY PURGE, MEMORY STATS, MEMORY USAGE, MODULE, MODULE HELP, MODULE LIST, MODULE LOAD, MODULE LOADEX, MODULE UNLOAD, MONITOR, PSYNC, REPLCONF, REPLICAOF, RESTORE-ASKING, ROLE, SAVE, SHUTDOWN, SLOWLOG, SLOWLOG GET, SLOWLOG HELP, SLOWLOG LEN, SLOWLOG RESET, SWAPDB, SYNC, TIME.