r/mysql • u/eachDayIWakeUp • Oct 05 '26
question How do MariaDB users securely and efficiently encrypt mariadb-backup archives?
Hello everyone!
I’m looking for practical recommendations from people running MariaDB in production.
My backup process will use mariadb-backup with zstd compression, and I want to encrypt the resulting backup securely without adding (too much) excessive CPU, memory, or operational overhead.
I’ve considered GPG/PGP, but I’m concerned about its performance and complexity. I’ve also seen age recommended, although I’m unsure whether it provides an appropriate security level for long-term MariaDB backups.
What encryption method or workflow do you use for MariaDB backups?
In particular, I’d appreciate feedback on:
- Encryption tools and algorithms you use.
- Whether encryption happens before or after compression.
- CPU and performance impact on large backups.
- Key management, rotation, and recovery procedures.
- Whether you encrypt locally, stream directly to object storage, or use storage-side encryption (which unfortunately is not available to my usecase).
- Any practical issues with restoring backups during an outage.
I’m mainly interested in real-world experience rather than theoretical recommendations.
1
u/Burgergold Oct 05 '26
Do you want them encrypted locally on the system, at rest or remotely on a backup system?
Because at rest can be managed by the storage system and remotely on the backup system can be managed by the backup system too
1
u/Least_Ad_1795 Oct 06 '26
I wouldn’t pivot completely. Your 5 years of data experience is valuable. I’d build on it by learning Python, SQL, statistics, and basic AI/LLM concepts. Start using AI in your current analytics work and gradually move toward Data Science or AI-focused roles. That gives you a safer transition than starting over in a completely different career.
1
u/TomaRavelli Oct 05 '26
Stream it.
mariadb-backup --backup --stream=xbstream, then zstd, then encrypt. Compress first. zstd on ciphertext barely shrinks, and you pay the CPU twice.Same order in the docs, gzip/zstd then openssl or gpg: https://mariadb.com/docs/server/server-usage/backup-and-restore/mariadb-backup/using-encryption-and-compression-tools-with-mariadb-backup age is fine if it is a recipient key, not a passphrase in the job. openssl enc -aes-256-cbc is the boring option and restores the same way. GPG usually hurts because of the agent, trustdb, and a passphrase prompt at 3am, not because of the cipher.What breaks restore is not the algorithm:
On CPU, zstd -1 or -3 plus AES on a large InnoDB copy is usually disk-bound, not RAM-bound. If the box is already at the ceiling during backup, cap threads (--parallel and zstd -T) instead of switching ciphers.
1
u/thewallacio Oct 06 '26
This tool is for MySQL, not MariaDB but we've been using it for both.
https://github.com/cytopia/mysqldump-secure
Not foolproof but it gives us some peace of mind that our offsite dumps are at least encrypted.
1
u/Amazing-Mirror-3076 Oct 06 '26
So this is still beta but if you are interested I'm the maintainer and happy to provide support.
https://github.com/onepub-dev/reVault
It uses zstd for compression and post quantum crypto plus signing.
Cli tools in cargo (revault_cli) and bindings for a dozen languages.
1
u/GoldsteinEmmanuel Oct 06 '26
Why do you need the backups encrypted? It may not be necessary in the first place, and in the event of media degradation you could lose the entire backup instead of a few files.
1
u/schorsch3000 Oct 06 '26
i just use restic.
no compression, but deduplication, so in the end everything will be fine.
1
u/that1guyrob Oct 08 '26
I just dump to tar.gz then encrypt the file using OpenSSL