Using Valkey as a drop-in replacement for Redis

I switched from Redis to Valkey today and wanted to share my results. I use Docker Compose so your mileage may vary with other deployment tooling.

The change was straightforward and seamless. Here’s a short reusable checklist:

  • destroy nextcloud server and redis containers
  • update redis sidecar in compose.yml
    • change redis service name to valkey
    • change image for this service from redis to valkey/valkey
    • change command for this service: redis-server becomes valkey-server
  • update redis-session.ini
    • change connection string in session.save_path from tcp://redis:6379 to tcp://valkey:6379
  • update nextcloud config.php
    • change redis.host to valkey
  • start nextcloud server and redis containers

After all that, my Nextcloud server appeared to work exactly as it did before. Maybe a bit faster, but that might be wishful thinking. I didn’t measure response times before/after.

I didn’t find anything exactly like this before posting, but if I missed something please let me know. Redis replacement? is relevant.

Valkey is likely to gain more traction when the most popular LTS Linux distributions such as Ubuntu, Debian and RHEL have switched to it, but this will not happen until the next major releases of the respective distributions are out, as all current releases still ship with Redis.

In short, it will probably take another year or two, and at some point Nextcloud will hopefully officially support it and mention it in their documentation.

@meonkeys you complicated 2 much, i just replaced one line and deleted dump.rdb from

  • /docker/ncloud/redis:/data

Original:

nc_redis:
image: redis:alpine
container_name: nc_redis
restart: unless-stopped
volumes:
- /docker/ncloud/redis:/data

=========================================================
modified:

nc_redis:
image: valkey/valkey:8.0.1-alpine3.20
container_name: nc_redis
restart: unless-stopped
volumes:
- /docker/ncloud/redis:/data