mongoshield drill
Prove a backup restores: restore into a scratch deployment, check, clean up.
mongoshield drill [backup] [options]Restores the backup into temporary databases on a scratch deployment, checks document counts and indexes (and, with --sample, documents byte for byte), runs your --assertions, then drops the temporary databases. Prints the RTO: how long the restore took. The result is recorded next to the backup.
Arguments
Section titled “Arguments”| Argument | Description | |
|---|---|---|
[backup] | optional | Backup id, or "latest" (default) |
Options
Section titled “Options”| Option | Description |
|---|---|
--target-uri <mongodb-uri> | Scratch deployment to restore into (required, or MONGOSHIELD_DRILL_URI; never the configured source). |
--sample <n> | Documents per collection to compare byte for byte with the backup (time series: field by field). Default: 0. |
--assertions <file> | A .ts/.js file whose default export checks the restored data. |
--keep | Keep the temporary databases for inspection. |
--prefix <prefix> | Prefix of the temporary database names. Default: msdrill_. |
--allow-same-deployment | Allow the target to be the backup's own source deployment. |
--include <pattern> | Only these namespaces, e.g. app.* or app.users. Repeatable. |
--exclude <pattern> | Skip these namespaces, e.g. *.audit_*. Repeatable. |
--from <storage-url> | Where backups are stored: ./dir, file:///abs, s3://bucket/prefix (default: config). |
--identity-file <path> | age identity file for encrypted backups (from mongoshield keygen). Repeatable. |
--passphrase-env <VAR> | Read the encryption passphrase from this environment variable. |
The global options (--config, --json, --quiet,
--verbose, --no-color, --yes) work here too.
Examples
Section titled “Examples”Drill the latest backup into a scratch cluster:
mongoshield drill --target-uri $SCRATCH_URI --identity-file ~/keys/backup.keyCompare 100 random documents per collection and run your own checks:
mongoshield drill latest --target-uri $SCRATCH_URI --sample 100 --assertions ./drill.tsMongoShield is MIT licensed and is not affiliated with, endorsed by or sponsored by MongoDB, Inc. MongoDB is a trademark of MongoDB, Inc.Privacy policy