Before you start: migrate from Redis to KiviDB
Run these against the Redis primary. Each answer decides something below.
Run these against the Redis primary. Each answer decides something below.
export REDISCLI_AUTH="$REDIS_PASSWORD"
R="redis-cli -h redis.internal -p 6379"
$R INFO server | grep -E 'redis_version|redis_mode' # version; standalone, sentinel or cluster
$R INFO keyspace # keys per database, and how many expire
$R INFO memory | grep -E '^used_memory_human|maxmemory_human|maxmemory_policy'
$R INFO commandstats | grep -E 'cmdstat_(eval|evalsha|fcall|function)'
$R FUNCTION LIST
$R MODULE LIST
$R ACL LIST
$R CONFIG GET notify-keyspace-events
| If you see | Then |
|---|---|
cmdstat_eval, cmdstat_evalsha, cmdstat_fcall, or libraries in FUNCTION LIST | Self-hosted: the lua or full build. KiviDB Cloud: turn Lua on when you create the database. Default and free-tier databases have no Lua. |
Modules in MODULE LIST (search, ReJSON, timeseries, bf, vectorset) | See modules below. |
redis_mode:cluster | See From Redis Cluster. |
| Sentinel in front of the primary | See From a Sentinel setup. |
Users other than default in ACL LIST | See ACL users. |
maxmemory_policy other than noeviction | Set the same policy on KiviDB (--maxmemory-policy); KiviDB has Redis's policies. |
Sizing. used_memory is what Redis holds now. Give KiviDB at least that
much plus headroom for growth; on KiviDB Cloud, a database's data size must be
at least the size of the RDB file you import.
Modules
Check which keys belong to a module. This counts keys by type with SCAN, and
is safe to run on a live server (it only reads):
redis-cli -h redis.internal --scan | while read -r k; do redis-cli -h redis.internal TYPE "$k"; done | sort | uniq -c
| Type | What it is | Comes across? |
|---|---|---|
ReJSON-RL | a JSON document | Yes, by every method in this guide |
search index (no key; FT._LIST) | a search index | No: run FT.CREATE again after the move. It indexes the keys already there. The same for FT.DICTADD dictionaries and FT.ALIASADD aliases |
TSDB-TYPE | a time series | No: an RDB file holding one is refused whole, and DUMP/RESTORE does not carry it. Recreate with TS.CREATE and TS.MADD |
MBbloom--, MBbloomCF, CMSk-TYPE, TopK-TYPE, TDIS-TYPE | Bloom, cuckoo, count-min, top-k, t-digest | No: refused the same way. Rebuild from the source data |
vectorset | a vector set | No: rebuild with VADD |
If an RDB file holds a module type KiviDB does not read, KiviDB refuses the whole file and says which type, rather than loading part of it. Move those keys with an application script, then delete them from the source (or filter them out of a copy tool, below) before the main copy.
ACL users
Self-hosted KiviDB reads the same ACL rules. Copy the users across:
redis-cli -h redis.internal ACL LIST > users.acl # lines like: user app on #<sha256> ~* &* +@all
kividb --aclfile /etc/kividb/users.acl
Passwords are stored as SHA-256 hashes, so the file carries them without
showing them. Check the rules load with ACL LIST on KiviDB, and test a sign-in
as each user.
On KiviDB Cloud you create users in the console (Configuration → Users),
each with a profile (read-write, read-only, Pub/Sub) or a role your
organization defines. Server management commands (CONFIG, ACL, DEBUG,
MODULE, MIGRATE, replication, SAVE/BGSAVE) are denied to every user,
whatever their rule says. See Users and passwords.