Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 832
Oleksandr Avatar asked Sep 15 '25 09:09

Oleksandr


1 Answers

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.

like image 180
dizzyf Avatar answered Sep 17 '25 23:09

dizzyf