Check out v4 of the Fauna CLI
v4 of the Fauna CLI is now in beta. The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start. |
Database backup and restore
Fauna automatically replicates your database to maintain high availability and resilience to regional outage. However, replication doesn’t protect against operator errors, such as accidental deletions.
You can use Fauna’s backup and restore feature to take a snapshot of a database and restore it when needed. The feature protects against operator errors, logic bugs, and other operational issues.
Advantages
Fauna Backup offers several key advantages:
-
Fully managed with Zero-Ops: You can automate the backup process, which requires no manual intervention or administrative overhead.
-
Fast recovery: Fauna stores database snapshots for quick and efficient restores.
-
Secure: Built-in security measures ensure access to your backups are strictly controlled.
Requirements
To configure backups or restore a database snapshot, you must:
-
Have the Startup, Pro, or Enterprise plan
-
Be an owner or administrator for your Fauna account.
How backups work
Daily, at or near 6 AM UTC, Fauna takes a snapshot of databases that have backups enabled. Snapshots have the following attributes:
-
Each snapshot includes all database schema and documents, including:
-
Access providers
-
Child databases
-
Collections, including indexes
-
Credentials
-
Functions
-
Keys
-
Roles
-
Tokens
You have the option of scheduling snapshot generation daily, weekly, or monthly.
-
-
Snapshots are stored internally, outside of the main database, and aren’t downloadable.
-
Snapshot storage exists in the same Region Group as the original database.
-
Daily snapshots don’t affect previously created snapshots.
-
By default, snapshots are retained for 30 days, although you can choose a custom retention period:
-
5 days
-
15 days
-
1 month (default)
-
3 months
-
6 months
-
1 year
-
indefinitely
-
-
Expired snapshots are removed no more than 24 hours after the retention interval expires.
-
Snapshots exist at the account level and are retained even if the original database is deleted or if backups are disabled for the database. This is convenient for recovering an accidentally deleted database.
Manage and restore backups
You can enable, manage, and restore backups in the Fauna Dashboard.
Enable backups
You can define backup properties when you create a database and for existing databases.
When you create a database
You can define the backup properties for a database when you create the database.
-
Log in to the Fauna Dashboard, and on the Home page, click Create Database.
-
In addition to entering the other database properties, enable backups and define backup properties in the Backups section:
Toggle Enable-backups to enable and disable backups.
If you enable backups, choose the backup properties:
-
Backup-Schedule options:
-
Daily (default)
-
Weekly
-
Monthly
-
-
Backup-Retention options:
-
5 days
-
15 days
-
1 month (default)
-
3 months
-
6 months
-
1 year
-
indefinitely
-
-
-
Click Create to create the database with the backup properties you selected.
For an existing database
You can also enable and disable backups and define backup properties for existing databases.
-
Log in to the Fauna Dashboard.
-
Choose Backups in the left navigation panel to view your databases and the database backup properties.
-
In the row of the database you want to change backup properties for, click the ACTIONS icon on the far right.
-
In the Backup-settings dialog and if backups aren’t already enabled for the database, toggle Enable-backups to enable backups. Otherwise, skip to the next step.
-
If you enable backups, you’re prompted to enter backup frequency and retention properties:
-
Backup-Schedule options:
-
Daily (default)
-
Weekly
-
Monthly
-
-
Backup-Retention options:
-
5 days
-
15 days
-
1 month (default)
-
3 months
-
6 months
-
1 year
-
indefinitely
-
-
-
Click Save to save your backups selections.
Create a database from a snapshot
-
Log in to the Fauna Dashboard.
-
Choose Backups in the left navigation panel to view your databases and the database backup properties.
-
In the row of the database you want to restore from a snapshot, hover over and click the Create a new database from a snapshot icon on the far right.
Restore a database from a snapshot
-
Log in to the Fauna Dashboard.
-
Choose Backups in the left navigation panel to view your databases and the database backup properties.
-
In the row of the database you want to restore from a snapshot, hover over and click the Restore this database from previous snapshot icon on the far right.
View backup status and snapshots
-
Log in to the Fauna Dashboard.
-
Choose Backups in the left navigation panel to view your databases and the database backup properties.
-
If not already selected by default, choose the Databases menu item to view your databases and the backup properties for each database:
Property Description NAME
Database name. Use the arrows to sort the list on database name.
REGION-GROUP
Database Region Group. Use the arrows to sort the list on Region Group.
BACKUPS
Backups enabled state. A ✓ indicates backups are enabled for the database.
LATEST SNAPSHOT (UTC)
Time in UTC of the last backup.
NEXT SNAPSHOT (UTC)
Scheduled time in UTC of the next backup.
FREQUENCY
Database backup frequency
RETENTION
Retention interval for the database backup.
ACTIONS
Enable or disable backups for the database. Click the icon and toggle Enable-backups.
-
To view available snapshots, choose the Snapshots menu item.
Disable backups and snapshots
For databases whose BACKUPS status indicates that backups are enabled, follow these steps to disable backups.
-
Log in to the Fauna Dashboard.
-
Choose Backups in the left navigation panel to view your databases and the database backup properties.
-
In the row of the database you want to change backup properties for, click the ACTIONS icon on the far right.
-
Toggle Enable backups.
-
Click Save to save the change.
The BACKUPS status for the selected database indicates that backups are disabled.
Billing
Creating and restoring snapshots consumes Transactional Compute Operations (TCOs). Fauna also charges to store snapshots. For details, see Backup and restore in the Fauna Billing docs.
Limitations
-
You can’t snapshot databases nested 10 or more levels below a top-level parent database. If you back up a database that includes child databases, regardless of how deeply nested, the child database is backed up with the parent database.
-
Up to five restores can be in progress simultaneously. If you try to restore more than five databases simultaneously, an error message displays.
-
Snapshots are internally consistent up to the logical time that the snapshot is created. Snapshots don’t include document changes or index builds that complete after the snapshot transaction time.
-
Index builds that started but aren’t completed before a database snapshot is taken don’t resume when the snapshot is restored. After restoration or copying, these indexes have a status of
active: false
. To resume building these indexes, delete the index and recreate it. -
You should review the restored database for inactive index builds when you restore or copy from a snapshot.
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!