How do I use dump.rdb for data recovery
wanghe-fit2cloud opened this issue · 1 comments
specific operation:
- redis-cli bgsave command is used to backup redis data and dump.rdb backup file into the backup directory
- clear the redis database
- replace the backup dump.rdb file with the existing dump.rdb file(all three redis nodes operate)
- delete the pod of the current redis master (kubectl delete pod redis-0)
redis master has been switched to redis-1, the dump.rdb file in master-1 is newly generated, the dump.rdb file you backed up earlier was not loaded, so the data recovery failed
Hi!
Apparently backup and restore were out of the scope for the initial development. :(
First off I have next to none understanding of how to properly make Redis backups, check their integrity, how and where to store them and how to properly recover them back.
Please note that the rdb file alone is not enough for a consistent backing up of the Redis state. In order to make an up-to-date backup you will need both RDB and AOF files.
The next thing to consider is never ever perform a recovery on a live system.
Instead you should have your backup stored in a safe place, preload it to a freshly created data volume, then start a new Redis instance with the data volume mounted. Once you are sure that your fresh recovered instance is OK, you should stop and decomission the old Redis.
I think you could test it out manually this way:
- save the rdb file somewhere
- create a persistentvolumeclaim similar to the existing ones with suffix
-0
(it should be formatted something like<volumeClaimTemplate.Name>-redis-<redis.name>-0
). It should get attached to the first pod of a new Redis statefulset created by the operator and hopefully it will work out.
Please let me know if this works for you.