[Rspamd-Users] Migrating Rspamd: How to keep bayes ham/spam learning?

Alexander Moisseev moiseev at mezonplus.ru
Mon Jan 11 15:41:48 UTC 2021

11.01.2021 16:39, Cédric пишет:
> Thanks for the quick reply.
> I did a simple rsync of the redis dump.rdb file and it worked perfectly.
> I noticed the doc says:
> "Copying RDB files is completely safe while the server is running. You don’t have to stop redis or rspamd."
> I did it a first time while redis and rspamd where started.
> It didn't work because dump.rdb where rewritten (I guess because an email or something happen during the rsync)
The article is about backup. You definitely should stop redis before restoring database, otherwise it will be overwritten with next dump (periodic or on shutdown).
Redis is in-memory database and reads rdb only on startup.

Actually, Redis doesn't rewrite *.rdb files. It writes data in a new temporary file, then renames it.
That means if the copying process has already opened the rdb file it will continue to read the same file by its inode even it was renamed during the process.

But if you are copying a directory and the file was renamed between directory listing and opening the file, rsync will complain about vanished file.
I'd consider it safe too since it won't result in broken backup database, just failed backup.

More information about the Users mailing list