Skip to content

mongoshield journal

Record every change for point-in-time recovery (start | status).

Terminal window
mongoshield journal <action> [options]

journal start runs the change journal writer until stopped: every change is recorded into encrypted, chained segments next to the backups, so a restore can stop at any second after a base backup (mongoshield restore --at). Run exactly one writer per storage location; a lease makes sure of it.

journal status shows the recovery point, how far behind it is (RPO), the covered time ranges and any gaps.

ArgumentDescription
<action>requiredstart or status
OptionDescription
--uri <mongodb-uri>Connection string (default: config source.uri, MONGOSHIELD_URI or MONGODB_URI).
--to <storage-url>Where the backups and the journal live (default: config storage).
--from <storage-url>Where backups are stored: ./dir, file:///abs, s3://bucket/prefix (default: config).
--include <pattern>Only these namespaces, e.g. app.* or app.users. Repeatable.
--exclude <pattern>Skip these namespaces, e.g. *.audit_*. Repeatable.
--recipient <age1…>Encrypt segments to this public key (default: config encryption). Repeatable.
--segment-seconds <n>Close a segment after this many seconds (the normal worst-case RPO). Default: config journal.segmentSeconds, else 300.
--segment-size <size>…or once it holds this much change data. Default: config journal.segmentBytes, else 64MiB.
--on-gap <backup|fail>When change history is lost: take a new base backup, or stop. Default: config journal.onGap, else backup.
--heartbeat <url>Ping this URL after every segment (healthchecks.io style).
--wait-for-leaseWait for a running writer to stop instead of failing (rolling updates).
--max-rpo <duration>status: exit 1 when the recovery point is older than this, e.g. 10m.

The global options (--config, --json, --quiet, --verbose, --no-color, --yes) work here too.

Run the writer next to the configured backups:

Terminal window
mongoshield journal start

One-minute segments, encrypted to a public key:

Terminal window
mongoshield journal start --segment-seconds 60 --recipient age1…

Check the journal, alerting when it is more than 10 minutes behind:

Terminal window
mongoshield journal status --max-rpo 10m