VALKEY-ADMIN(7)

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

πŸ’– NAME πŸ’–

valkey-admin β€” it's giving Administration, bestie. This is the page where we talk about setting Valkey up so it actually thrives instead of dramatically flopping. ✨


🌸 Valkey setup tips 🌸

🐧 Linux 🐧

  • Deploy Valkey using the Linux operating system. Valkey also gets regularly tested on macOS and FreeBSD, and from time to time on other OpenBSD, NetBSD, DragonFlyBSD and Solaris-derived systems. But like… Linux is where most of the stress testing happens, and where most production deployments actually run. That's the vibe. πŸ‘‘
  • Set the Linux kernel overcommit memory setting to 1. Add vm.overcommit_memory = 1 to /etc/sysctl.conf. Then reboot, or run sysctl vm.overcommit_memory=1 to activate it. Peep valkey-faq(7) FAQ: Background saving fails with a fork() error on Linux? for the details, iykyk. 🧠
  • So the Linux kernel feature Transparent Huge Pages doesn't mess with Valkey's memory usage and latency, run: echo never > /sys/kernel/mm/transparent_hugepage/enabled to disable it. See valkey-latency(7) Latency Diagnosis - Latency induced by transparent huge pages for extra context. πŸ’…

🧠 Memory 🧠

  • Make sure swap is enabled and that your swap file size equals the amount of memory on your system. If Linux doesn't have swap set up and your Valkey instance accidentally eats too much memory, Valkey can crash when it's out of memory, or the Linux kernel OOM killer can just… kill the Valkey process 😭. When swapping is enabled, you can detect latency spikes and act on them.
  • Set an explicit maxmemory option limit on your instance so it reports errors instead of failing when the system memory limit is near. Lowkey important: maxmemory should be set by calculating the overhead for Valkey other than data, plus the fragmentation overhead. So if you think you have 10 GB of free memory, set it to 8 or 9. No cap. πŸ“
  • If you're using Valkey in a write-heavy application, while saving an RDB file on disk or rewriting the AOF log, Valkey can use up to 2 times the memory normally used. That extra memory is proportional to the number of memory pages modified by writes during the saving process, so it's often proportional to the number of keys (or aggregate types items) touched during that time. Size your memory accordingly, bestie. ✨
  • See the LATENCY DOCTOR and MEMORY DOCTOR commands to help with troubleshooting. 🩺

πŸ‘» Imaging πŸ‘»

  • When running under daemontools, use daemonize no. Simple as that. πŸŽ€

πŸ” Replication πŸ”

  • Set up a non-trivial replication backlog in proportion to the amount of memory Valkey is using. The backlog lets replicas sync with the primary instance much more easily. 🫢
  • If you use replication, Valkey performs RDB saves even if persistence is disabled. (This does not apply to diskless replication.) If you don't have disk usage on the primary, enable diskless replication. πŸ’Ύ
  • If you're using replication, ensure that either your primary has persistence enabled, or that it does not automatically restart on crashes. Replicas will try to maintain an exact copy of the primary, so if a primary restarts with an empty data set, replicas will be wiped as well. πŸ’€ That's the drama we're avoiding.

πŸ”’ Security πŸ”’

  • By default, Valkey does not require any authentication and listens to all the network interfaces. This is a big security issue if you leave Valkey exposed on the internet or other places where attackers can reach it. Please check our valkey-security(7) security page and the valkey-quickstart(7) quick start for info about how to secure Valkey. Protect your queen. πŸ‘‘

☁️ Running Valkey on EC2 ☁️

  • Use HVM based instances, not PV based instances.
  • The use of Valkey persistence with EC2 EBS volumes needs to be handled with care, because sometimes EBS volumes have high latency characteristics. πŸ‘€
  • You may want to try diskless replication if you have issues when replicas are synchronizing with the primary. 🌈

πŸš€ Upgrading or restarting a Valkey instance without downtime πŸš€

Valkey is designed to be a long-running process on your server. You can modify many configuration options without a restart using the CONFIG SET command. You can also switch from AOF to RDB snapshots persistence, or the other way around, without restarting Valkey. Check the output of the CONFIG GET * command for more info. ✨

From time to time, a restart is required β€” for example, to upgrade the Valkey process to a newer version, or when you need to modify a configuration parameter that's currently not supported by the CONFIG command.

Follow these steps to avoid downtime. 🫢

  • Set up your new Valkey instance as a replica for your current Valkey instance. To do that, you need a different server, or a server that has enough RAM to keep two instances of Valkey running at the same time.
  • If you use a single server, ensure the replica is started on a different port than the primary instance, otherwise the replica cannot start. 🚫
  • Wait for the replication initial synchronization to complete. Check the replica's log file. πŸ“„
  • Using INFO, ensure the primary and replica have the same number of keys. Use valkey-cli to check that the replica is working as expected and is replying to your commands. πŸ’¬
  • Allow writes to the replica using CONFIG SET replica-read-only no.
  • Configure all your clients to use the new instance (the replica). Note that you may want to use the CLIENT PAUSE command to ensure that no client can write to the old primary during the switch. ⏸️
  • Once you confirm the primary is no longer receiving any queries (you can check this using the MONITOR command), elect the replica to primary using the REPLICAOF NO ONE command, and then shut down your primary. πŸ‘‘

If you're using valkey-sentinel(1) or valkey-cluster-tutorial(7) Valkey Cluster, the simplest way to upgrade to newer versions is to upgrade one replica after the other. Then you can perform a manual failover to promote one of the upgraded replicas to primary, and finally promote the last replica. πŸ¦‹


That's the whole page, bestie β€” every flag, every path, every warning, all of it, untouched. Facts stay iconic, only the vibe got a glow-up. πŸ’…

This was VALKEY-ADMIN(7) from the Valkey Manual β€” version 9.0.0, dated 2025-10-21. Mwah, take care of your instances and slay responsibly. πŸŽ€βœ¨πŸ’œ

πŸ“¦ where this page comes from