Search code examples
amazon-web-servicesredisdumpamazon-elasticacheredis-cli

Restart redis server from rdb restoring expired keys


I got snapshot rdb file from server. At the point of snapshoting there was keys with defined ttl using EXPIRE command . After starting server locally with the key --dbfilename dump.rdb all keys with defined ttl expired. For me it seems that there should be keys in binary file anyway.

If it can help: the snapshot was created in AWS elasticache environment.

Is it possible to start server from backup and restore keys?


Solution

  • Nope. From the docs (emphasis mine):

    Keys expiring information is stored as absolute Unix timestamps (in milliseconds in case of Redis version 2.6 or greater). This means that the time is flowing even when the Redis instance is not active.

    https://redis.io/commands/expire

    If you want backups to exist indefinitely, all keys must be persisted.