Cut over: migrate from Aiven to KiviDB
Cut over. Migrate to KiviDB: Move from Redis, Valkey, ElastiCache, Redis Cloud, Aiven, Aerospike, Hazelcast and more: getting the data out, loading it, cuttin
-
Rehearse. Copy into a test KiviDB, run your test suite against it, and run the verify script. Time the copy.
-
Turn on keyspace notifications on the Aiven service. The copy tools follow changes through them, and
CONFIG SETis disabled on Aiven, so set them through Aiven:avn service update my-valkey --project my-project -c valkey_notify_keyspace_events=KEA -
Start the long copy. RedisShake with
ksn = true, or RIOT with--mode LIVE(on Valkey 9, RIOT with--mode LIVE --struct). Leave it running. It copies every key, then applies the changes your application makes while it runs. RedisShake needsrdb_restore_command_behavior = "rewrite"here: a key that changes is copied again over the old copy, and with the default setting the first such key stops the copy with aBUSYKEYerror. If the notifications are not on, neither tool says so: the copy simply misses every change made after the scan passed a key. -
Check it has caught up. Run the verify script against both sides. A few keys changing in flight is expected.
-
Stop writes to Aiven. Put the application in maintenance mode, or stop the writers.
-
Let the last changes arrive (a few seconds), stop the copy, and run the verify script again. The key counts should now match.
-
Switch the application to KiviDB (see below) and start it.
-
Watch errors and latency. Keep the Aiven service, untouched, until you are sure.
Without keyspace notifications, the copy is a one-off: stop writes at step 3 and keep them stopped until step 7.
Rolling back. Until step 7 nothing points at KiviDB and nothing is lost.
After it, writes go only to KiviDB, and copying them back is narrower than
copying them in. KiviDB's DUMP payloads are in its own format, which Valkey
refuses, so RedisShake and RIOT's default mode fail with
ERR DUMP payload version or checksum are wrong.
RIOT reads through Lua scripts, so it also needs Lua on the KiviDB it reads from.
What works is RIOT with --struct, reading from a KiviDB that has Lua (the
lua or full build, or the Lua add-on on Cloud):
riot-standalone-4.3.0-linux-x86_64/bin/riot replicate --struct \
--source-tls --source-cacert kividb-ca.pem --source-user kividbapp --source-pass "$KIVIDB_PASSWORD" \
--target-tls --target-user default --target-pass "$AIVEN_PASSWORD" \
--ttl-tolerance 10s \
rediss://your-name.cloud.kividb.io:6380 \
rediss://my-valkey-my-project.e.aivencloud.com:12691
Rehearse it if you may need it. The simplest safety net needs no copy at all: for the first days after the switch, have the application write to both KiviDB and the Aiven service (reads from KiviDB only), so the Aiven service stays current and switching back is a change of address. Without that, and without Lua on KiviDB, the way back is to keep the Aiven service untouched and accept losing the writes made since the switch.
For a cache your application can rebuild, there is a simpler way: point the application at an empty KiviDB and let it fill.