Backing up Metabase: what your team must protect and why restores fail
A self-hosted Metabase needs a recoverable application database before anything else is decided. The application database, not the warehouses Metabase queries, holds dashboards, saved questions, users, groups, permissions and the connection details for your data sources. Losing it means losing the business content your analysts built, and the warehouses themselves are untouched by that loss. Treat the application database as the system of record for Metabase and plan its backups with the same discipline as any other production database that holds access control data.
Backups serve two purposes. The first is disaster recovery, when a host, volume or database fails. The second is protection before change: Metabase runs application database migrations automatically during upgrades, and the upgrade documentation recommends backing up the application database first. Rollback after a failed upgrade is done by restoring that pre-upgrade backup, which means the backup must exist and be complete before the upgrade starts. Confirm with your own team how often backups run and whether a backup is taken before each Metabase version change, not only on a fixed schedule.
A backup without a tested restore and a matching encryption key is not a recovery plan. If MB_ENCRYPTION_SECRET_KEY is set, Metabase encrypts stored database connection details with AES256 and SHA512, and losing or changing that key means re-entering every encrypted connection. The key must therefore be stored with the backup set, in a controlled location, and be restored alongside the database. Schedule a restore test into a separate environment, confirm that Metabase starts against the restored database with the same key, and record how long the restore took. That measured time, not an assumed one, is the recovery time you can promise.
Backup approach by application database: PostgreSQL, RDS or H2
This table compares the application database options Metabase supports, the backup method each one implies and who owns that mechanism. Read it to match your production or demo setup to a backup approach, then confirm the details against your own environment. The main takeaway is that production instances should run on PostgreSQL, RDS or a supported MySQL or MariaDB version, while the H2 file is a demo option with a manual copy step.
| Application database | Backup method | Who owns the backup | When it fits |
|---|---|---|---|
| PostgreSQL (recommended for production) | Database-level dump or snapshot of the Metabase application database, taken while Metabase is stopped or quiesced | Your database team, using PostgreSQL tooling and your backup policy | Production instances that need scheduled, tested backups and point-in-time recovery |
| Amazon RDS for PostgreSQL | Automated backups and snapshots provided by the managed service, plus any manual snapshots you add | Shared: AWS provides the mechanism, your team sets retention and tests restores | Production on AWS where the database team already runs managed backups |
| MySQL 8.4.0 or later with utf8mb4 | Logical dump or the platform's snapshot tooling, with the character set kept at utf8mb4 | Your database team | Production teams that standardize on MySQL and can keep the character set correct |
| MariaDB 10.6.0 or later with utf8mb4 | Logical dump or the platform's snapshot tooling, with the character set kept at utf8mb4 | Your database team | Production teams that standardize on MariaDB and can keep the character set correct |
| Embedded H2 file (demos only) | Copy the file /metabase.db/metabase.db.mv.db out of the container with docker cp, while Metabase is stopped | The person running the instance, manually | Evaluations and demos where losing data is acceptable |
| H2 file moved to PostgreSQL or MySQL | Back up the new database with its own tooling, and keep the original H2 file until the move is verified | Your database team after the migration | Any instance that outgrows H2 and needs a production backup method |
Why the encryption key must travel with the backup
A Metabase backup is only restorable in full if the encryption key that protected its stored connection details is available alongside it. The cards below cover what the key protects, what happens when it is lost or changed, and how to store it separately from the dump under your own secrets practice.
What the key protects
Setting MB_ENCRYPTION_SECRET_KEY makes Metabase encrypt database connection details in the application database using AES256 and SHA512. The application database dump therefore contains encrypted connection records, not the key that opens them. The dump alone does not restore your data source connections. Confirm which fields in your instance are encrypted before you assume a backup is complete.
Losing the key
If the key is lost, Metabase cannot decrypt the stored connection details, and every encrypted database connection must be entered again by someone with admin access. For an instance with many warehouses, this is a manual rebuild of connections, along with their sync settings and downstream dependencies such as saved questions and dashboards that rely on them. Ask who holds a copy of the key and whether that person can be reached during an incident.
Changing the key
Changing the value of MB_ENCRYPTION_SECRET_KEY has the same effect as losing it: the existing encrypted connection details can no longer be read with the new value. A key rotation therefore needs a planned re-entry of connections or a documented procedure agreed with Metabase's current guidance. Record the key version in change tickets, and never rotate it as a side effect of a container image or environment file update.
Storing the key apart from the dump
Keep the key in your organization's approved secrets manager, such as a vault or cloud key service, with access limited to the people and automation that run restores. Store the dump in backup storage with its own access controls. Keeping both in the same bucket, file share or repository defeats the separation and turns one stolen artifact into a full exposure of connection credentials. Confirm who can read each store and log those reads.
Checking the pair in restore tests
A backup and its key should be tested together. During a restore test, start Metabase with the restored application database and the matching key, then confirm that a sample database connection loads and a query runs. Repeat the test after any key change or Metabase upgrade. A restore that succeeds with the wrong key or no key will show a healthy instance with broken connections, so the test must check connections, not just that the service starts.
How to set up a repeatable Metabase backup
This sequence turns backing up Metabase from a one-off task into a documented routine: you know what is being protected, the encryption key sits beside the backup, the copy is taken by a method suited to your database, and each run is checked before anyone relies on it.
Inventory the application database and version
Confirm which database Metabase uses for its application data: the embedded H2 file, PostgreSQL, MySQL or MariaDB, or an Amazon RDS instance. Record the running Metabase version, the JAR or container image tag, and where the instance runs. This matters because the backup method, and any later restore, depends on the database engine and the version that last wrote to it. The step is done when the inventory sits in your runbook and someone outside the team can read it. Confirm the exact configuration in your own environment, because a Docker deployment, a systemd service and a Kubernetes pod often keep settings in different places.
Record the encryption key in a secrets store
If the instance sets MB_ENCRYPTION_SECRET_KEY, copy its value into your organization's approved secrets manager and note which environment it belongs to. Metabase uses this key to encrypt database connection details stored in the application database. Without the same key, a restored database cannot decrypt those connections, and every encrypted connection must be entered again. Store the key next to the backup set, not in the same file, and limit read access to the people who perform restores. The step is done when a named engineer retrieves the key from the secrets store and the value matches the running configuration.
Schedule a database-native backup
Choose the method that matches the engine. For PostgreSQL, schedule a logical dump or a storage snapshot taken while the database is consistent. For Amazon RDS, use automated snapshots or point-in-time recovery. For H2, the file copy is safest while the Metabase instance is stopped, because the file can be locked while the application runs. Copy the H2 file out of a container with docker cp, using the path Metabase documents for the H2 file. Run the job on a schedule your recovery needs define, and have the job write to storage separate from the Metabase host. The step is done when the first scheduled run completes without errors in the job log.
Set retention and off-host copies
Decide how many backup generations to keep, how long to keep them, and whether any copy must leave the primary site or account. Retention is shaped by your recovery objectives, your data classification and any record-keeping rule that applies to your organization, so confirm those with your compliance and legal owners rather than copying a figure from another team. Keep at least one copy outside the system that runs Metabase. Also keep the encryption key's retention aligned with the backups it unlocks, so no backup outlives the key that opens it. The step is done when the retention policy is written down and the storage lifecycle rules reflect it.
Verify that each backup file is complete
After every run, check that the output exists, is non-empty, and has a size and timestamp within the range you expect from previous runs. For PostgreSQL dumps, read the file header or list its contents with the restore tool, which confirms the archive is readable without restoring it. For H2 copies, confirm the file was copied from a stopped instance or that the copy completed without a lock error. Alert on any failed check, and log the checksum so later comparisons can detect corruption. The step is done when a failed or empty file triggers an alert to the owning team.
Confirm the key can be retrieved
On a schedule, have an authorized engineer retrieve MB_ENCRYPTION_SECRET_KEY from the secrets store and compare it with the value in the running instance without printing it to logs or chat. Confirm the key and the backup set are both reachable by the restore role, and that access to them is logged. Check after any secrets rotation or change of platform, because a rotated key that is not matched to older backups creates a restore that cannot decrypt connections. The step is done when the check is recorded with a date, the person who ran it and the result.
Document the sequence and assign owners
Write the backup procedure as a runbook: the inventory, the schedule, the retention rule, the verification checks, the key location and the alert routes. Name an owner for each step and a backup for each owner. Store the runbook with the infrastructure code or in your controlled wiki, and review it after each Metabase upgrade, because upgrades run application database migrations and the backup taken before an upgrade is the rollback path. The step is done when the runbook is approved by the platform owner and linked from the on-call guide.
How to prove a Metabase restore works before you need it
A backup only counts once you have restored it somewhere else and watched Metabase come up. Run the restore test in a separate environment that matches production: the same Metabase version, the same MB_ENCRYPTION_SECRET_KEY value stored with the backup, and a copy of the application database from the backup, whether that is PostgreSQL, RDS or an H2 file such as /metabase.db/metabase.db.mv.db. Start Metabase there and check four things in order: an administrator can log in, a sample dashboard loads with its cards returning data, a saved question runs, and at least one database connection works. The last check matters most. If the connection fails, the key is usually wrong or was changed, because Metabase cannot decrypt stored connection details without it, and you will need to re-enter every encrypted connection.
Record what you checked, the Metabase version, the backup timestamp and the time from restore start to a working login. That last number is your practical recovery time estimate, and it should come from your own environment, not from a generic figure. Ask your database team to confirm how long the restore of the application database itself takes at your data size, and confirm that the key is stored separately from the database backup with its own access controls. A restore test that passes on a laptop with a small database says little about a production restore under load.
Repeat this test after any change that affects the backup path: a Metabase upgrade, a move to a new database host, a key rotation, a change to the H2 file location or a new container image. Upgrades need particular care because Metabase runs application database migrations automatically. The upgrading guidance recommends backing up the application database first, and rollback is done by restoring that pre-upgrade backup or by running the migrate down command with the newer JAR. Practice the rollback path in the test environment before the upgrade window, so the restore you rely on in an incident has already worked once. Keep the test result with your change record so an auditor or incident lead can see when recovery was last proven.
Restoring from PostgreSQL, RDS and H2 backups
When Metabase uses a PostgreSQL server you operate, the restore is a database restore on your own infrastructure, and the work is in the recovery method you chose before an incident. A logical dump taken with pg_dump restores the application database into a new or emptied server, but it only returns you to the moment the dump was taken. If you need to recover to a point between backups, the PostgreSQL continuous archiving and point-in-time recovery guidance describes keeping a base backup with archived write-ahead log so you can replay to a chosen time. Confirm which method your backup job actually produces before you rely on it.
- Restore into a clean target: Restore to a server with the same major PostgreSQL version or a compatible one, and confirm the database owner and extensions match what Metabase expects.
- Test point-in-time recovery separately: A base backup plus archived logs is a different procedure from a dump, so rehearse each one you claim to support.
- Record the restore time: Time a full restore on a copy of production-sized data so your recovery time expectation is based on measurement, not assumption.
- Point Metabase at the restored database: Update the connection settings, then start Metabase and confirm it migrates cleanly to the version you run.
- Keep the encryption key with the restore set: Restored connection details stay unreadable without the matching
MB_ENCRYPTION_SECRET_KEY.
Before you sign off, confirm that a restore has been run end to end in a non-production environment within the last review cycle and that someone other than the original operator has completed it.
When the application database is a managed PostgreSQL instance, such as Amazon RDS, the provider's snapshot and point-in-time restore features usually replace the server level backup you would run yourself. A restore in this model creates a new database instance from a snapshot or a point in time, and you then move Metabase to the new endpoint. The steps you must still own are confirming retention settings, choosing the restore target, and verifying that the restored instance has the same parameters, networking and credentials as the original. Ask your provider and your team to confirm these details for your environment rather than assuming defaults.
- Confirm retention and backup windows: Check the configured backup retention period and whether automated backups are enabled for the instance Metabase uses.
- Plan the endpoint change: A restored instance usually gets a new endpoint, so the Metabase connection setting and any network rules must be updated.
- Check parameter and security groups: Confirm the restored instance uses the same parameter group, subnet placement and security group rules, or Metabase cannot reconnect.
- Rehearse the cutover: Restore a snapshot into a test account or subnet, start Metabase against it, and verify logins and saved questions load.
- Protect the encryption key: The provider snapshot does not carry Metabase's secret key, so store
MB_ENCRYPTION_SECRET_KEYin a system you can recover independently.
Ask the managed database vendor to confirm the exact restore options available for your instance class and region, and confirm who is responsible for cross-account or cross-region copies.
An H2 application database is an embedded file, and Metabase documents a one-time load-from-h2 command that moves its contents into PostgreSQL or MySQL. For the file itself, Metabase's backup guidance shows copying the H2 file out of the container or host, such as /metabase.db/metabase.db.mv.db in Docker, before any change. The migration must be run with the same Metabase version that last updated the H2 file, so the version recorded on the file is the one you must reproduce. Treat the H2 file as a fragile source and take a fresh backup before you start the migration.
- Confirm the last writer version: Identify the Metabase version that last ran against the H2 file and install that exact version for the load.
- Take a fresh copy first: Stop writes where possible, copy the H2 file to a separate location, and verify the copy size and timestamp before migrating.
- Run load-from-h2 into an empty target: Point the command at an empty PostgreSQL or MySQL application database, not one that already holds Metabase data.
- Move the encryption key deliberately: Use the same
MB_ENCRYPTION_SECRET_KEYon the new database, or encrypted connections must be re-entered. - Start on the target database: After the load completes, reconfigure Metabase to use the new database and verify logins, dashboards and scheduled jobs.
Do not delete the H2 file until the migrated instance has run through a full review of users, data sources and subscriptions.
PostgreSQL backup considerations that affect recovery time
The application database backup is only one part of recovery. The PostgreSQL version you run, how it is replicated, how failover is handled and how connections are pooled all shape how long a restore takes and whether it succeeds. Review these factors before you agree on a recovery time with your stakeholders.
Version support window
PostgreSQL 14 is supported until November 12, 2026, while 18 is the newest supported major version. A Metabase application database on an unsupported PostgreSQL version still restores, but security fixes stop arriving, and the restore target must match the version your backup tooling expects. Confirm which major version your backups were taken from and plan any major upgrade as a separate change, with its own test restore, before the backup you depend on is taken on an older version.
PostgreSQL versioning policyHot standby is not a backup
A hot standby replays changes from the primary and can serve read-only queries, which helps availability. It also replays mistakes, such as an accidental deletion or a bad migration, so it does not replace point-in-time recovery from a base backup and archived WAL. Keep a separate, restorable copy of the application database and test that restore. Treat replicas as a way to shorten failover, not as the answer to a corrupted or deleted Metabase configuration.
Synchronous versus asynchronous replication
With synchronous replication, a commit waits until standbys confirm it, so a failover loses no committed Metabase changes, but writes slow down when a standby is slow or unreachable. Asynchronous replication keeps writes fast but can lose the most recent changes at failover. Decide which trade-off suits your team, then document how much recent Metabase activity, such as saved questions or permission changes, you can afford to lose and how you will re-enter it.
Failover is external
PostgreSQL does not detect a failed primary or notify a standby to take over. Automatic failover needs a separate tool or a documented manual procedure, and that choice sets your recovery time more than the backup itself. Metabase reconnects only to the address it is configured with, so confirm how the connection string, DNS or a virtual address moves to the new primary and rehearse that switch with the Metabase application running.
PostgreSQL failover docsConnection pooling during restore
During a restore, many connections from Metabase and other clients can block the database from accepting the restore or from running the cutover cleanly. A pooler such as PgBouncer lets you pause traffic, redirect clients to the restored database and resume without changing every application configuration. Check that the pooler is included in your restore runbook, that its settings match Metabase's connection pool, and that you can reach the restored database through it before you need it.
PgBouncer projectSetting realistic recovery time expectations for Metabase
Recovery time for Metabase is not a fixed figure. It depends on how large the application database is, which restore method you use, how quickly the Metabase JAR and its container or host can be rebuilt, how fast you can retrieve the MB_ENCRYPTION_SECRET_KEY value that belongs with the backup, and how long it takes to re-validate database connections and confirm that saved questions, dashboards and subscriptions load correctly. Each of these steps can dominate the total time depending on your setup, so a single number borrowed from another team or a vendor brochure will not match your environment.
The most reliable way to set expectations is to measure your own restore during the restore test described above. Time each step separately: fetching the backup, restoring the PostgreSQL or RDS snapshot (or the H2 file, if you still run H2), starting a Metabase container or host on the same version, supplying the encryption key, and checking that the connections to your data warehouses still authenticate. Record where the time went. The slowest step is usually the one to improve first, and the measured figures become the baseline for your recovery plan. Note that restoring a database alone does not restore a working Metabase if the key is missing, because encrypted connection details cannot be read without it.
When you engage a hosting provider or a partner, ask for their measured restore time for a Metabase instance of your size, the recovery time objective and recovery point objective they commit to, and the conditions under which those figures apply, all in writing. Ask who holds the encryption key during a restore, how often the restore test is run, and what evidence is kept from each test. If a provider cannot show a measured result, treat any stated objective as a target to verify in your own test rather than a guarantee.
Protecting backups: access, retention and the key
A Metabase backup is a copy of production data and credentials, so it needs the same controls as the live system. The cards below cover who can reach dumps, how they are encrypted, where the key lives, which database roles perform the work and how long copies are kept.
Treat backups as production data
A Metabase application database holds user accounts, group and permission settings, saved questions, dashboards and stored connection details for your data sources. Anyone who can read a dump can read that content and, where the encryption key is absent or exposed, the saved database credentials. Before you sign off a backup design, confirm that the people and systems allowed to copy, download or restore dumps match the people allowed to administer the live instance.
Restrict access to dump files
Limit read and write access to the backup location to a small set of named service accounts and operators, and log every copy, download and restore. For H2 installs, the file to protect is the database file itself, such as metabase.db.mv.db, which is copied out of the container with docker cp. Check that object storage buckets, shared network folders and developer laptops are not quietly holding copies with broader access than the source system.
Encrypt dumps and snapshots at rest
Dump files, volume snapshots and cloud backup copies should be encrypted at rest with keys managed by your organization, using the storage platform's encryption features. Encryption of the backup file does not replace the Metabase encryption secret, and it does not protect a dump restored to an unprotected host. Ask your storage team to confirm which layer encrypts each copy and who holds the keys for it.
Keep the encryption key apart from the backup
Store the MB_ENCRYPTION_SECRET_KEY value in a secrets manager, separate from the dump. Metabase encrypts database connection details in the application database, so a restore without the matching key leaves every encrypted connection unusable and requires re-entering each one. Keep the key in a separate, access-controlled location with its own change record, and make sure the backup procedure captures the key version in use at the time of the dump.
Use least-privilege database roles
Create a dedicated database role for Metabase's application database that owns only what the instance needs, and a separate role for backup jobs that can read but not alter data. Review whether the backup role can drop or replace tables and whether it can read the warehouse databases that Metabase connects to. Confirm the exact privileges with your database administrator for your PostgreSQL, RDS or MySQL version before you rely on them.
Set retention to match your policies
Set how long each backup and each pre-upgrade copy is kept according to your records and recovery policies, and document it alongside the schedule. Keep a pre-upgrade backup until the new version has run cleanly for long enough to be confident in it, and remove expired copies on a schedule that is also logged. Ask your compliance lead which retention periods apply to user activity and query history, since those tables are included in the dump.
How backup and restore move between Metabase, the application database and the key store
The flow starts with Metabase writing its configuration, users, saved questions and dashboards to the application database, which is PostgreSQL, RDS or H2 in your environment. A scheduled backup job copies that database into backup storage, while the MB_ENCRYPTION_SECRET_KEY value is kept in a separate secrets store, not beside the dump. To restore, you start a test instance with the same key and the same Metabase version, then check login, dashboards and database connections before anyone relies on it.
Backup and restore paths for the application database and the encryption key.
Questions teams ask before backing up Metabase
Can our in-house team back up Metabase on its own?
Yes, if you have people who can administer the application database and the environment it runs in. The work is mostly routine: take a consistent copy of the application database, store it outside the Metabase host, and keep the MB_ENCRYPTION_SECRET_KEY value with it. Three things decide whether a team can do this alone: database access with rights to dump or snapshot the application database, a documented custodian for the encryption key, and a separate restore environment where backups can be tested without touching production. Teams without a restore environment usually discover gaps only during an incident, so confirm those three items before you decide.
What drives the effort of a Metabase backup project?
The main drivers are the application database engine, the number of environments, and how rigorously restores are tested. A PostgreSQL or RDS application database uses standard database tooling, while an H2 file needs a different procedure and usually a migration first, as described in the Metabase backup documentation. Each additional environment such as staging or a disaster recovery site adds its own schedule, storage and access rules. Testing rigor changes the work most: a one-time proof that a restore boots is much smaller than a scheduled restore test with documented results and an agreed recovery target.
What should a quote for Metabase backup work include?
A useful quote states the scope in writing before work starts. Ask for these items to be listed explicitly:
- The application database engine and versions covered, and whether H2 is in scope
- The backup method, schedule, retention period and storage location
- How the
MB_ENCRYPTION_SECRET_KEYis stored, who holds it and how it is rotated - The restore tests: how often they run, what they verify and where they run
- Documentation of the runbook and the recovery steps
- A handover session with the team that will operate the backups afterwards
Also ask which items are one-time and which recur, such as scheduled restore tests or retention reviews. Any figure should be tied to that written scope.
How long does restore testing take?
Restore testing time depends on what you are proving and on the size of the data, not on a fixed duration. The main drivers are the size of the application database, the time needed to provision a clean restore environment, whether the Metabase version used for the restore matches the backup, and how much validation you want after the restore starts. Restoring into a fresh environment with a known Metabase version and checking that logins, connections and saved content load is a bounded exercise. Confirm the expected duration with the people running the test, using your own database size and infrastructure, before you commit a schedule.
Does the open source edition of Metabase include backup tooling?
No. The open source edition does not ship a backup product. Backups rely on the tools of the application database you chose: PostgreSQL dump or snapshot tools for PostgreSQL, the managed snapshot features for RDS, or file copies for H2 while Metabase is stopped. Metabase documents the procedures and the encryption key requirement, so your team must build the schedule, storage and restore process with the database's own tooling. Check the current Metabase documentation for your version, because backup guidance can change between releases.
Why does the encryption key need to be stored with the backup?
Metabase encrypts database connection details in the application database when MB_ENCRYPTION_SECRET_KEY is set. A backup without the matching key restores the content, but the stored connection details cannot be decrypted, so each connection must be entered again. Store the key in a secrets manager with access controls, record which key belongs to which backup set, and test that a restore works with the key that was in use at the time. Changing the key without re-encrypting causes the same loss, so treat key rotation as a documented change with its own test.
Can a backup be used to roll back a failed Metabase upgrade?
Yes. Metabase recommends restoring the pre-upgrade application database backup for rollback, and the alternative is running the migrate down command with the newer JAR. Take the backup immediately before the upgrade, record the Metabase version it came from, and restore into a version that matches that backup. Check the Metabase upgrade documentation before each upgrade, since migration behavior and rollback steps are version specific.
Who should own the backup and restore process after handover?
Ownership should sit with a named team that runs the Metabase platform, with the database team responsible for the database tooling and the security team responsible for key custody. Write down who runs scheduled restore tests, who can access the backup storage and who approves a restore into production. Without named owners, backups continue to run while restore tests quietly stop. Ask for this ownership model to be part of the handover documentation.
How DeployOpen scopes and delivers Metabase backup and restore work
DeployOpen is a Chainscore Labs company that plans, implements and supports self-hosted open-source platforms inside the infrastructure the client controls, including the cloud accounts, data centers or air-gapped networks where a Metabase instance runs. For backup and restore, that means the work happens against your own application database, whether it is PostgreSQL, Amazon RDS or the embedded H2 file, and your own encryption key, with no copy of your data leaving your environment. Engagements are fixed-scope, so the written scope should name the database engine, the backup tooling you already use, the storage location, the retention period and the restore targets before any work starts.
A typical written scope for this work covers the backup design, the scheduled job or managed snapshot configuration, the key handling procedure that keeps MB_ENCRYPTION_SECRET_KEY recorded alongside each backup, and a restore test into a separate environment. The restore test is where the evidence comes from: the deliverable should show that a backup was restored, that Metabase started against the restored database, and that the database connections and saved content loaded. Ask for the evidence format in the quote, such as a dated test record and the exact versions used. Restore testing can be repeated, so agree in advance how many runs are included and what happens if a test fails.
Ongoing work such as repeating restore tests, checking backups after Metabase upgrades and keeping the runbook current is available as a retainer. DeployOpen does not issue audit reports, attestations or certifications. Restore evidence can support an independent assessor's review of your controls, but the assessor and certification body make that determination. Confirm with your auditor which records they will request before the first restore test, so the evidence you receive matches what they need.

