Valkey should be a one-to-one Redis replacement, but there were some snags.

Redis to Valkey
Installed was Redis 8.6.1 from ports.
Target is Valkey 9.0.3 from ports.
Isn't too complicated, but there are some snags.
Differences
The installations do not share the user and group.
| Redis | Valkey | |
|---|---|---|
| uid | 535 | 537 |
| gid | 535 | 537 |
| configuration | etc/redis.conf |
etc/valkey.conf |
| db | /var/db/redis/dump.db |
/var/db/valkey/dump.db |
| logs | /var/log/redis/redis.log |
/var/log/valkey/valkey.log |
| PID file | /var/run/redis/redis.pid |
/var/run/valkey/valkey.pid |
| socket | /var/run/redis/redis.sock |
/var/run/valkey/valkey.sock |
| db version | 12 | 9.0.3 |
Migrating
Based on the Physical Migration documentation.
Install the Valkey package
pkg install valkey
Inspect the running Redis instance
$ redis-cli -s /var/run/redis/redis.sock
redis /var/run/redis/redis.sock> INFO KEYSPACE
# Keyspace
db0:keys=795972,expires=32,avg_ttl=27686559,subexpiry=0
redis /var/run/redis/redis.sock> CONFIG GET dir dbfilename
1) "dbfilename"
2) "dump.rdb"
3) "dir"
4) "/var/db/redis"
redis /var/run/redis/redis.sock> SAVE
OK
(0.60s)
redis /var/run/redis/redis.sock> ^D
We'll be using this info for the copy and verify steps later.
The configuration files mostly portable. Copy the database dump to the new location too.
sed -i '' "s/redis/valkey/g" /usr/local/etc/redis.conf /usr/local/etc/valkey.conf
cp /var/db/redis/dump.rdb /var/db/valkey/
For testing, I edited valkey.conf and set it to use a different port.
Check the config file to make sure you don't have conflicting options with redis.
$ service valkey enable
valkey enabled in /etc/rc.conf
The logs will tell you what went wrong. Tail the logfile to see what's happening.
$ service valkey start
$ tail -f /var/log/valkey/valkey.log
...
6431:M 07 Mar 2026 09:37:43.232 * Server initialized
6431:M 07 Mar 2026 09:37:43.232 * Cleaning slot migration log in anticipation of a load operation.
6431:M 07 Mar 2026 09:37:43.232 # Can't handle RDB format version 12
6431:M 07 Mar 2026 09:37:43.232 # Fatal error loading the DB, check server logs. Exiting.
...
Fails to start due to differences in the dump format. The workaround for this was to edit the config, not strict but relaxed, disable aof
#rdb-version-check strict
rdb-version-check relaxed
#appendfilename "appendonly.aof"
And starting valkey again
$ tail -fn0 /var/log/valkey/valkey.log &
$ service valkey start
Starting valkey.
11552:M 07 Mar 2026 09:40:24.151 * oO0OoO0OoO0Oo Valkey is starting oO0OoO0OoO0Oo
11552:M 07 Mar 2026 09:40:24.151 * Valkey version=9.0.3, bits=64, commit=00000000, modified=0, pid=11552, just started
11552:M 07 Mar 2026 09:40:24.151 * Configuration loaded
11552:M 07 Mar 2026 09:40:24.151 * monotonic clock: POSIX clock_gettime
root@scan:/usr/local/etc # 11552:M 07 Mar 2026 09:40:24.152 * Running mode=standalone, port=6379.
11552:M 07 Mar 2026 09:40:24.152 * Server initialized
11552:M 07 Mar 2026 09:40:24.152 * Cleaning slot migration log in anticipation of a load operation.
11552:M 07 Mar 2026 09:40:24.152 * Loading RDB produced by Redis version 8.4.1
11552:M 07 Mar 2026 09:40:24.152 * RDB age 46 seconds
11552:M 07 Mar 2026 09:40:24.152 * RDB memory usage when created 64.30 Mb
11552:M 07 Mar 2026 09:40:24.476 * Done loading RDB, keys loaded: 795969, keys expired: 0.
11552:M 07 Mar 2026 09:40:24.476 * DB loaded from disk: 0.324 seconds
11552:M 07 Mar 2026 09:40:24.476 * Ready to accept connections tcp
11552:M 07 Mar 2026 09:40:24.476 * Ready to accept connections unix
Notice the line "Loading RDB produced by Redis version 8.4.1"
Connect to the valkey instance and create a new backup dump.rdb in the Valkey format.
$ valkey-cli -s /var/run/valkey/valkey.sock
redis /var/run/redis/redis.sock> INFO KEYSPACE
# Keyspace
db0:keys=795972,expires=32,avg_ttl=27686559,subexpiry=0
redis /var/run/valkey/valkey.sock> CONFIG GET dir dbfilename
1) "dbfilename"
2) "dump.rdb"
3) "dir"
4) "/var/db/valkey"
redis /var/run/valkey/valkey.sock> SAVE
OK
(0.59s)
redis /var/run/valkey/valkey.sock> ^D
The db0:keys have the same number of keys, I call it good enough.
Now we prepare for the actual switch:
- Stop Valkey:
service valkey stop - Revert
valkey.confchanges tordb-version-checkand aof - Set port to regular
6379 - Stop Redis
redisservice redis stop - Start Valkey
service valkey start - Disable Redis
service redis disable
Clean up
pkg delete redis
rm -rf /var/db/redis
rm -rf /var/log/redis
rm -rf /var/run/redis
sed -i '' '/^redis_enable/d' /etc/rc.conf
