SafeGrd / MongoDB backup

MongoDB backups that are restored on a schedule

SafeGrd backs up MongoDB 7 and 8 with mongodump --archive, streaming the archive straight into an encrypted snapshot on your host. The snapshot is written to S3-compatible storage under Object Lock and restored on a schedule, and every collection's document count is checked against the one mongodump recorded.

Run your first Fire Drill Read the install guide

curl -fsSL https://safegrd.dev/install.sh | sh
safegrd backup --database-url "mongodb://backup:$DB_PASSWORD@db.internal:27017/app?authSource=admin" --retention-days 14

What each backup holds

What a Fire Drill checks

An in-memory drill reads the archive to its end and matches document counts and collection checksums with the values mongodump recorded. A sandbox drill restores the archive into a temporary database with mongorestore, counts each collection there, and drops the temporary collections when it is done. Each result is signed and added to your record, and a failed drill alerts your team.

What to know before you rely on it

How to restore

Point the restore at an empty database, under any name, on a host that has the CLI, the MongoDB Database Tools and the key.

safegrd restore --snapshot SNAPSHOT_ID --target "mongodb://user:pass@host:27017/recovered"

The target has to be empty: the restore refuses a database that already holds collections. If a restore fails partway, drop the target database before you run it again.

The restore loads the archive with mongorestore and counts each collection against the manifest written at backup time (Restore and Fire Drills).

Questions

What does the host need?

The MongoDB Database Tools (mongodb-database-tools) and a network path to the server. SafeGrd only reads, so the backup user needs no write role.

Can I restore it without SafeGrd?

The CLI is source-available and restores from your own bucket with or without an account. After it decrypts a snapshot, the archive inside is the format mongorestore reads.

Who holds the decryption key?

You choose when the key is made. With a SafeGrd-managed key, SafeGrd keeps your key sealed and releases it only to your enrolled hosts, so you can restore even after losing a host. With a customer-managed key, only you can decrypt these backups.

Related