Valkey 9.0
Valkey is an open-source, high-performance in-memory data store and Redis-compatible alternative. It is commonly used for caching, session storage, real-time leaderboards, pub/sub messaging, and job queues.
Software included
Section titled “Software included”| Component | Version |
|---|---|
| Valkey | 9.0.x |
| Ubuntu | 24.04 LTS |
Getting started
Section titled “Getting started”1. Connect to your VM
Section titled “1. Connect to your VM”ssh ubuntu@<your-vm-ip>2. Wait for first-boot configuration
Section titled “2. Wait for first-boot configuration”On the first boot, a setup script runs automatically. It generates a random password and configures Valkey to require authentication on every connection. This takes under 30 seconds.
Track progress:
journalctl -u valkey-first-boot.service -f3. Retrieve credentials
Section titled “3. Retrieve credentials”sudo cat /etc/valkey/credentials.txtThis file contains the password and connection instructions. It is only readable by root.
4. Connect to Valkey
Section titled “4. Connect to Valkey”VALKEY_PASS=$(sudo awk '/^Valkey password:/{print $NF}' /etc/valkey/credentials.txt)valkey-cli -a "$VALKEY_PASS"Confirm the connection:
127.0.0.1:6379> PINGPONGManaging Valkey
Section titled “Managing Valkey”# Check service statussystemctl status valkey
# Restartsudo systemctl restart valkey
# View logssudo journalctl -u valkey -fConfiguration files:
| File | Purpose |
|---|---|
/etc/valkey/valkey.conf | Main configuration |
/etc/valkey/99-memory.conf | Memory limit and eviction policy |
To set a memory limit, edit /etc/valkey/99-memory.conf:
maxmemory 512mbmaxmemory-policy noevictionThen restart Valkey. The default policy is noeviction, which returns an error when memory is full
rather than silently evicting data.
Security
Section titled “Security”Port 6379 is not open externally by default. UFW is enabled and allows SSH (port 22) only.
To allow access from a specific IP:
sudo ufw allow from <trusted-ip> to any port 6379To connect without opening the firewall (recommended), use an SSH tunnel:
# Run this on your local machinessh -L 6379:localhost:6379 ubuntu@<your-vm-ip>
# Then connect locallyvalkey-cli -a "<password>"