VALKEY.CONF(5)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’– VALKEY.CONF(5) β€” the Valkey Configuration Manual, bestie edition πŸ’–

okay so this is valkey.conf(5), the configuration manual, and honestly? it's giving "instruction booklet that actually slaps." let's get into it 🫢


✨ NAME ✨

valkey.conf β€” Configuration. that's it, that's the name, short and iconic πŸ‘‘


🌸 DESCRIPTION 🌸

so like, Valkey can start with zero config file at all β€” it's got a built-in default configuration, main character energy, no prep needed. but (and this is a big but) that setup is only recommended for testing and development purposes. do not run your whole production empire on the default vibe, bestie 😭

the proper way to configure Valkey is by giving it a Valkey configuration file, usually called valkey.conf. that's the whole point of this page.

the valkey.conf file is full of directives and the format is genuinely so simple it's not even funny:

keyword argument1 argument2 ... argumentN

here's a real example of a configuration directive, look at her:

replicaof 127.0.0.1 6380

and yes, you can absolutely pass strings with spaces as arguments, just wrap them in (double or single) quotes, like:

requirepass "hello world"

now the deets on quoting, because this part is lowkey important:

  • single-quoted strings can contain characters escaped by backslashes
  • double-quoted strings can additionally include any ASCII symbols encoded using backslashed hexadecimal notation "\xff"

the full list of configuration directives, what they mean and how you're supposed to use them, lives in the self documented example valkey.conf shipped into the Valkey distribution. so go read that one, it explains itself, iykyk ✨

  • the self documented valkey.conf for Valkey 8.1
  • the self documented valkey.conf for Valkey 8.0
  • the self documented valkey.conf for Valkey 7.2
  • the self documented redis.conf for Redis OSS 7.2
  • the self documented redis.conf for Redis OSS 7.0
  • the self documented redis.conf for Redis OSS 6.2

πŸ¦‹ Passing arguments via the command line πŸ¦‹

not me about to tell you that you can also pass Valkey configuration parameters straight up on the command line πŸ’… this is genuinely so useful for testing purposes. here's an example that starts a brand new Valkey instance using port 6380 as a replica of the instance running at 127.0.0.1 port 6379:

./valkey-server --port 6380 --replicaof 127.0.0.1 6379

the format of the arguments passed via the command line is exactly the same as the one used in the valkey.conf file, with one exception: the keyword is prefixed with --. that's the whole difference, periodt.

heads up: internally this generates an in-memory temporary config file (possibly concatenating the config file passed by the user, if any) where arguments are translated into the format of valkey.conf. so it's not magic, it's just a little translation moment 🧚

🌈 Changing Valkey configuration while the server is running 🌈

you can reconfigure Valkey on the fly without stopping and restarting the service, or query the current configuration programmatically, using the special commands CONFIG SET and CONFIG GET. living your best life, no downtime, no drama.

not all of the configuration directives are supported this way, but most are supported as expected. please refer to the CONFIG SET and CONFIG GET pages for more information, they've got the full scoop.

⚠️ real talk though: modifying the configuration on the fly has no effects on the valkey.conf file, so at the next restart of Valkey the old configuration will be used instead. the config file did not get the memo. she's still living in the past 😭

so make sure to also modify the valkey.conf file accordingly to the configuration you set using CONFIG SET. you can do it manually, or you can use CONFIG REWRITE, which will automatically scan your valkey.conf file and update the fields which don't match the current configuration value. and check this out:

  • fields non existing but set to the default value are not added
  • comments inside your configuration file are retained

obsessed, honestly. CONFIG REWRITE ate and left no crumbs πŸŽ€


πŸ“ Configuring Valkey as a cache πŸ“

if you plan to use Valkey as a cache where every key will have an expire set, you may consider using the following configuration instead (assuming a max memory limit of 2 megabytes as an example):

maxmemory 2mb
maxmemory-policy allkeys-lru

in this configuration there is no need for the application to set a time to live for keys using the EXPIRE command (or equivalent), since all the keys will be evicted using an approximated LRU algorithm as long as we hit the 2 megabyte memory limit. your app gets to be lazy and the server handles it, iconic behaviour tbh.

basically, in this configuration Valkey acts in a similar way to memcached. we have more extensive documentation about using Valkey as an LRU cache valkey-lru-cache(7) here. go read it, it's a whole thing πŸ’œ


🌟 SEE ALSO 🌟


and that's the whole page, bestie!! πŸ’– this was VALKEY.CONF(5) from Valkey version 9.0.0, dated 2025-10-21, and you read the entire thing, so proud of you, go forth and configure responsibly πŸ«Άβœ¨πŸŒΈπŸ’…

πŸ“¦ where this page comes from