Why Metabase H2 to PostgreSQL migration is a one-way step worth planning
The move from the embedded H2 application database to production storage is a one-time load-from-h2 run, and it must be executed with the same Metabase version that last wrote the H2 file. Metabase ships H2 for demos and recommends PostgreSQL for production, with MySQL 8.4.0 or MariaDB 10.6.0 and later (using utf8mb4) also supported. Once the data is loaded, the H2 file is no longer the source of truth, so treat the switch as a cutover you can only partly reverse. Before you start, confirm which Metabase version last touched the H2 file, since a mismatch is the most common reason the load fails or is run with the wrong binary.
The step looks simple because it is a single command, but the saved state is what makes it risky. The H2 file holds saved questions, dashboards, collections, users, groups and permission settings, which is everything your analysts have built. Stop the running instance so the file is not in use, copy the H2 file to a separate location, and keep it until you have verified the migrated instance end to end. Removing or overwriting the original file early leaves you with no fallback if the load or the new database configuration goes wrong.
Plan for the one-way nature explicitly: agree a window with the business, confirm who can sign off on the cutover, and record the Metabase version, the H2 file location and the target database details in your change record. Then check that the migrated instance shows the expected collections, permissions and data source connections before users return. The migrating from H2 documentation sets out the exact command and prerequisites, and you should confirm them against the version you are running.
The H2 file only moves when the matching JAR runs the load
The flow starts with the existing H2 application database file and the Metabase JAR that last updated it. That exact version must run the one-time load-from-h2 command, which copies the data into a new PostgreSQL or MySQL application database. Only after the load completes do you point Metabase at the new database, then check that users, questions, dashboards and connections are intact. Version match is a required gate: if the JAR differs from the version that last wrote the H2 file, stop and resolve it before loading.
The version gate and one-time load that move H2 data into a new application database.
Choosing PostgreSQL or MySQL as the target application database
PostgreSQL is the option Metabase recommends for production application databases, so it is the default most teams should evaluate first. The application database holds Metabase's users, permissions, saved questions, dashboards, and settings, so the database itself becomes a system your team has to run, patch, back up, and restore inside your own infrastructure.
- Operations skills: Choose PostgreSQL if your database team already runs it for other internal applications, since upgrades, vacuum maintenance, and connection limits will then follow familiar procedures.
- Backup tooling: Confirm that your existing backup product or managed snapshot process can capture the application database on a schedule and that a restore has been tested into a separate instance.
- Hosting: Decide whether it runs on a managed service in your cloud account, a database platform in your data center, or a server you administer directly, and confirm that the network path from Metabase nodes is limited to what is needed.
- Credentials: Create a dedicated database role for Metabase rather than reusing an administrative account, and keep its privileges limited to the application database.
- Version coverage: Check the PostgreSQL version against the Metabase version you plan to run in the official configuration documentation before the load begins.
Before committing, ask your database team to confirm the supported PostgreSQL version and backup method in writing.
Metabase also supports MySQL 8.4.0 or MariaDB 10.6.0 and later, provided the database uses the utf8mb4 character set. This option suits organizations that already standardize on MySQL-family databases and have operators, monitoring, and backup routines for them. Metabase's own documentation recommends PostgreSQL for production, so treat MySQL or MariaDB as a supported path that needs extra verification rather than an equal default.
- Operations skills: Choose this option if your team already runs MySQL 8.4 or MariaDB 10.6 or later well, because the risk then sits in the Metabase setup rather than in learning a new engine.
- Character set: Create the database with utf8mb4 from the start, since the requirement affects how text such as question names and dashboard titles is stored.
- Backup tooling: Confirm that your logical or physical backup method captures the application database consistently, and test a restore before the migration.
- Hosting: Confirm the server version and its support status with your database vendor or distribution, and check that the chosen version is one Metabase supports.
- Version pairing: Verify the exact supported database version for the Metabase release you will run, because support is stated as a minimum version.
Ask your database team to confirm the character set, server version, and backup restore test in writing before you choose this path.
The target database is not a setting you can switch silently after go-live. Moving Metabase from one application database engine to another is a data migration in its own right, so a later change needs another planned migration with its own backup, downtime window, and verification. The choice therefore belongs in the initial design, not in a later tuning pass.
- Irreversible in practice: Plan the target as a long-term decision, since reversing it means moving user accounts, permissions, and content again.
- Upgrade interaction: Remember that Metabase upgrades run application database migrations automatically, so the database you choose must stay workable through every upgrade you will apply.
- High availability: If you may run several Metabase instances later, a shared application database has to be chosen now, because the cluster design depends on it.
- Support obligations: Record which engine and version you chose and who owns it, so that audits and incident responses can point to a single source of truth.
- Documentation: Keep the decision record alongside the migration plan so that future administrators understand why the engine was selected.
Before go-live, confirm in writing with your Metabase owner and database team that the chosen engine is the long-term target.
Step-by-step load-from-h2 sequence and the check that closes each step
This sequence moves a Metabase application database from the embedded H2 file to PostgreSQL or MySQL with the one-time load-from-h2 command, and each step ends with a check that tells you it is safe to continue.
Confirm the running and H2 file versions
The team member who owns the Metabase host records the version of the running JAR and the version that last updated the H2 file. Load-from-h2 must be run with the Metabase version that last wrote to that file, so a mismatch is the first thing to resolve. Check the version string in the Metabase admin area and the JAR you have on hand, and confirm they match before going further. Done means you have written down one version and the JAR file you will use for the load.
Stop writes and schedule a window
Ask the Metabase administrator to tell users that the instance will be unavailable and to stop the application so no new questions, dashboards, users or settings change the H2 file during the copy. Confirm with the business owner how long the window needs to be, since the duration depends on the size of your application database and your environment, and ask your team to test it beforehand. Done means the application is stopped and no process still holds the H2 file open.
Back up the H2 file and any existing database
Copy the H2 database file to a location outside the Metabase host, and if an application database already exists (for example, a previous PostgreSQL instance), take a dump of it as well. Keep the backups until the migrated instance has passed its checks and a rollback path is no longer needed. Done means you can restore both backups to a test location and open them, which you should confirm before you start the load.
Provision an empty target database
Create an empty PostgreSQL database, or an empty MySQL database if you use MySQL, with a dedicated account that owns it. For MySQL, use utf8mb4 as the character set, as the Metabase application database documentation requires. Confirm that the database has no existing Metabase tables, since the load should go into a clean target. Done means you can connect with the account from the Metabase host and the database is empty.
Run load-from-h2 with the matching JAR
From the host, run the load-from-h2 command using the matching Metabase JAR and the target connection details, following the migrating from H2 documentation for the exact syntax. The command is one-time, so run it only once against the empty target. Watch the output for errors and note the final message. Done means the command completes without errors and the row counts or completion message in the output match what you expect for your instance.
Point the application database configuration at the new database
Update the environment variables or configuration that tell Metabase where its application database lives, following the configuring the application database documentation, so the new PostgreSQL or MySQL target is used instead of the H2 file. Keep the H2 file in place and do not delete it. Start Metabase and watch the log until the startup completes. Done means the logs show Metabase connected to the new application database and it starts without migration errors.
Verify users, content and permissions
Sign in as an administrator and check that users, groups, collections, saved questions, dashboards, database connections and permission settings all appear as they did before the window. Run several saved questions and one dashboard against the data source to confirm the queries still work. Ask a non-admin user to sign in and confirm their access matches expectations. Done means the spot checks match the pre-migration record and you have signed off the result in writing before you reopen the instance to users.
Keep the rollback path until checks pass
Leave the H2 backup, the pre-migration dump and the H2 file unchanged until the verification step is complete and the team has signed off. Record the Metabase version, the target database type and the backup locations in your runbook so an administrator can find them later. Done means the rollback artifacts are stored, labeled and linked from the runbook, and the team agrees on when they can be removed.
What goes wrong during the switch and how to catch it
Most failed H2 to PostgreSQL moves fail quietly rather than loudly: the load completes, the server starts, and the damage only shows up later. The cards below cover the failure points that recur in this migration, each with the symptom to look for, the cause behind it and the guard to put in place before go-live.
Version mismatch between JAR and H2 file
The symptom is a load that fails or a Metabase that will not start cleanly after the move. The cause is running load-from-h2 with a Metabase JAR that is not the same version that last updated the H2 file. The guard is to read the version recorded by the running instance before the migration, keep that exact JAR available, and run the load with it. Confirm the version in your own environment before you stop the old server.
Loading into a non-empty target
The symptom is a load that reports conflicts, or a target database that mixes old and new application data. The cause is pointing the load at a PostgreSQL or MySQL database that already holds Metabase tables from a test start or an earlier attempt. The guard is to use a freshly created, empty application database for the target, confirm it holds no Metabase schema, and record the target name in the change ticket so a rerun cannot write into the wrong database.
Character set problems on MySQL or MariaDB
The symptom is text in saved questions, dashboard names or descriptions that arrives garbled or truncated after the switch. The cause is creating the MySQL or MariaDB application database without utf8mb4, which Metabase requires for its application database. The guard is to create the schema with utf8mb4 before the load, then compare a sample of non-ASCII titles and descriptions in the source and target. Confirm the minimum MySQL 8.4.0 or MariaDB 10.6.0 version for your deployment before you choose the engine.
Application database docsStale H2 backup used for rollback
The symptom is a rollback that restores a file missing the most recent questions, users or dashboard changes. The cause is keeping a backup taken days before the cutover, or copying the H2 file while the server still writes to it. The guard is to stop Metabase, copy the H2 database file and its companion files together, and label that copy with the cutover time. Keep the old server stopped but intact until the new instance passes its checks.
Users or saved questions missing after the switch
The symptom is that users cannot sign in, or that collections, saved questions or dashboards appear empty. The cause is usually an incomplete load, a load run against the wrong target, or a new instance started with a fresh application database by mistake. The guard is to compare user, collection, card and dashboard counts between the H2 source and the PostgreSQL target, then sign in as a known admin and open a sample of saved questions before users are told the system is live.
What drives the effort and downtime of the move
This table lists the factors that change how long the H2 to PostgreSQL move takes and how long Metabase is unavailable. Read each row as a lever: the driver on the left is what grows the work, and the right column shows how to keep it under control before the cutover window opens.
| Driver | Why it changes effort or downtime | How to keep it down |
|---|---|---|
| Size of the H2 file | The load-from-h2 command copies the whole application database, so a larger H2 file generally means a longer copy and a longer window with Metabase stopped. | Check the file size first, remove obsolete data where your governance allows, and rehearse the load on a copy to measure the real run time. |
| Saved questions and dashboards | Many questions, dashboards and cards add rows and dependencies that must be checked after the switch, so validation takes longer even when the copy is quick. | Inventory the most-used content, agree a short list of critical dashboards to test, and archive unused items before the move. |
| Number of users and groups | Every user, group and permission mapping must load and log in correctly, and group-based access problems often surface only after go-live. | Export the current user and group list, confirm who needs access, and test one account from each permission group after the switch. |
| Single node or several nodes | A cluster must be reduced to a single node for the migration, and each additional node adds coordination, shutdown and restart steps. | Confirm the topology in advance, plan the node shutdown order, and record the target configuration so nodes can be restored cleanly. |
| Number of environments | Dev, staging and production each need the same procedure, so mistakes or surprises found in one environment repeat in the others. | Run the full procedure in a non-production copy first, document each run, and reuse the same runbook for production. |
| Custom configuration and embedding | Custom settings, SSO, embedded dashboards and allowed origins can break silently after a database change and need retesting. | Record environment variables and admin settings beforehand, and include embedded pages and SSO logins in the test list. |
| Database host and backup storage access | Creating the target PostgreSQL or MySQL database, granting credentials and storing the H2 backup all depend on access that may need change requests. | Request access to the target database host and backup location early, confirm credentials and network paths, and check that a backup can be restored. |
How the switch differs on a single node, a cluster and an air-gapped network
A single node is the simplest case: one Metabase JAR, one application database connection, and one place where the H2 file lives. The migration is a bounded maintenance task. You stop Metabase, run the one-time load-from-h2 command against the target PostgreSQL or MySQL database using the same Metabase version that last updated the H2 file, and then point the configuration at the new database and start the JAR again. The main planning question is how long the restart window needs to be, which depends on the size of your H2 file and your environment, so confirm that with a test run on a copy.
- Version match first: confirm the exact Metabase version that last wrote the H2 file before you run the load command, because the docs require the same version.
- One stop, one start: the service is down from the moment you stop the JAR until the new configuration is confirmed, so schedule that window with users informed.
- Keep the H2 file: leave the original H2 file in place and untouched until the new database has been checked.
- Configuration change: update the application database settings to the new host, database name and credentials, then restart.
- Rollback path: if the switch fails, restore the previous configuration and the H2 file, then start the same version again.
Before closing the window, check that users can sign in, that saved questions and dashboards load, and that scheduled jobs and data source connections still work.
In a cluster, several Metabase nodes share one application database, so the switch is a coordinated change rather than a single restart. Every node must end up pointing at the same new database, and no node should keep writing to the old H2 file during the cutover. The usual approach is to stop every node, run the load-from-h2 command once, reconfigure all nodes to the new database, and start them. Note that an H2 file cannot be shared across nodes in the way a server database can, so clusters typically start from a single-node H2 setup. Confirm the exact sequence in the vendor docs before you plan the window.
- Stop all nodes: shut down every node before the load so that no instance writes to the old database during the move.
- Same target everywhere: every node's application database settings must reference the same new host and database after the switch.
- Migration lock: the upgrade docs describe a migration lock, and the docs recommend reducing a cluster to a single node for major upgrades. Plan the switch so that nodes do not race to run migrations at startup, and confirm the startup order with the vendor docs.
- Load balancer: take nodes out of rotation before the window and return them only after the health checks pass.
- Version consistency: run every node on the same Metabase version after the switch.
Check that each node reports healthy, that sessions and scheduled jobs behave the same across nodes, and that no node still shows the old database in its configuration.
On an air-gapped network, Metabase cannot download anything during the switch, so every input must be staged in advance. That includes the exact Metabase JAR for the version that last wrote the H2 file, the PostgreSQL or MySQL server and its client components, any JDBC driver you need, the H2 backup, and the configuration files. The load-from-h2 step itself runs locally, so the risk is usually missing or mismatched artifacts, not connectivity. Because the environment is isolated, rehearse the procedure on an isolated test copy before the change window and record the checksums of every staged file.
- Stage the JAR: keep the exact version that last updated the H2 file in your internal artifact store, and verify its integrity before the window.
- Stage the database software: confirm the PostgreSQL or MySQL versions your organization supports and place their packages and dependencies on the isolated network.
- Stage drivers and backups: copy any JDBC drivers and a verified backup of the H2 file into the environment ahead of time.
- Rehearse offline: run the full procedure on a copy of the environment, including the rollback path, without any external access.
- Confirm license and support terms: check with the vendor how licensing and support are handled for offline installs, since this is not covered in the supplied facts.
After the switch, confirm that every staged artifact matches its recorded checksum and that the application works without any outbound connections.
Protecting credentials, backups and the migrated data
The H2 file, the migration host and the new PostgreSQL connection all hold the same business data and account records, so each needs the same care as production. The four cards below cover the controls to set before the load-from-h2 command runs and the checks to make before users return.
Least-privilege database credentials
Create a dedicated PostgreSQL role for the Metabase application database and grant it only the rights it needs on its own database, not superuser or access to other schemas. Metabase keeps its users, questions, dashboards and settings there, so a broad role would expose all of them. Confirm the role's exact grants against the current application database documentation before go-live, and keep the password out of shell history and plain-text config files.
Application database docsHandling the H2 backup
The H2 file contains user accounts, password hashes, session data and saved content, so treat the copy as sensitive. Store it encrypted or on restricted storage, record who holds it, and set a retention date after the migration is verified rather than keeping it indefinitely. Delete temporary copies made during testing, and confirm your own backup policy covers the file for the same period as the production database.
Restricting the migration host and JAR
The migration runs from a host that can read the H2 file and write to PostgreSQL, so limit shell access to the people running the migration and remove access once it closes. Use the same Metabase JAR version that last updated the H2 file, and keep copies of that JAR in a controlled location with checksums recorded. Log who ran the command and when, because the process touches every application record.
Migration from H2 docsVerifying TLS and encryption settings
Confirm that the connection from Metabase to the new database uses TLS and that the database server accepts only encrypted client connections for this role. Check the certificate chain that Metabase trusts and the encryption settings your PostgreSQL or MySQL version supports, and confirm the exact configuration keys with the vendor documentation for your version. Test the connection after setup and confirm that unencrypted connections are refused.
How to confirm the migrated Metabase works and fails safely
Treat the switch as complete only after a side-by-side count check of the application database. Before the load-from-h2 run, record the number of users, collections, saved questions and dashboards from the H2 instance, using the admin interface or the REST API. After the move, repeat the same counts against the PostgreSQL instance and investigate any difference before users return. Then sign in as an admin and as a standard user with restricted collection access, and confirm that each account sees the same collections and content it saw before. Keep the counts and the test accounts in your change record so the comparison can be repeated after later changes.
Next, exercise the parts of Metabase that depend on the connected data sources and background jobs. Open a representative set of saved questions and dashboards that query each production database, confirm they return results, and check that the data source connection settings carried over correctly. Review scheduled subscriptions and alerts, since these run from the application database and should be confirmed to fire on schedule. Check row and column permissions only if your plan includes them, because the open source edition does not offer those controls. Ask your Metabase contact to confirm which of these checks apply to your edition and configuration.
Plan the rollback before you start. The recommended path is to restore the pre-switch backup of the H2 application database and point Metabase back at it, so that the backup must be verified as restorable before the switch. Test the restore on a separate host and confirm that Metabase starts against it. The rollback options described in the upgrading Metabase documentation (restoring a backup or running the migrate down command) apply to later version upgrades, not to this one-time move from H2, so do not assume them here.
What to back up, monitor and document after go-live
This table lists what the team should protect, watch and record once Metabase runs on PostgreSQL instead of H2. Each row ties a control to the supported version windows, so the team can plan the next upgrade with a verified backup and a current runbook. Read it as a go-live checklist: the owner column shows who signs off each item.
| Item | What to do | Owner and timing |
|---|---|---|
| Application database backup before the next upgrade | Take a fresh backup of the new PostgreSQL application database before any upgrade, since rollback is done by restoring that backup or running migrate down with the newer JAR | Database administrator, before every upgrade |
| Database and application log monitoring | Watch PostgreSQL availability, connection counts and storage growth, and review Metabase application logs for migration or database errors after the switch | Platform engineering, continuous with alert review |
| Recorded Metabase version | Record the exact Metabase version and JAR build in the runbook, since load-from-h2 had to match the version that last updated the H2 file | Platform owner, updated at each upgrade |
| Version support window | Track the end-of-life date for the running release, noting LTS versions are supported for 14 months and non-LTS versions usually for about 2 months | Platform owner, reviewed against the version support page |
| Target database settings | Document host, database name, encoding, character set and the least-privilege account used by Metabase, with each setting's owner | Database administrator and security team, kept in the runbook |
| Retired H2 file retention | Keep the old H2 file read-only for an agreed period after cutover, then archive or delete it under the data retention policy | Platform owner and compliance lead, decided before cutover |
| Post-switch checks log | Record the results of the post-switch checks, such as login, saved questions and dashboard queries, with the date and tester name | QA or analytics lead, filed at go-live |
Questions teams ask before moving off H2
How much does moving Metabase off H2 cost?
The software move itself carries no license fee, because the load-from-h2 command is part of Metabase and the open source edition is licensed under the AGPL. Cost comes from labor and infrastructure: the time to plan the window, prepare a PostgreSQL or MySQL application database, run the move and verify the result, plus the database server you run it on. Scope drivers include how many Metabase instances or environments need the move, how large the H2 file is, whether you use SSO or other paid features that need configuring afterward, and how much testing your team requires before cutover. Ask any partner for a fixed-scope quote that lists each environment, the database platform, the backup approach, the verification steps and who performs each one.
How long does the migration take, and does it need downtime?
Yes, plan for downtime. Metabase should be stopped while the H2 file is copied to the new application database, because the install must not change during the move. The duration depends on the size of the H2 file, the speed of the target database, the number of environments and how many checks your team runs before users return. Ask for a timeline that separates the rehearsal on a copy from the production window, since a rehearsal shows the real duration and exposes version or permission problems before users are affected. Confirm the window with the people who own dashboards that refresh on schedule.
Can our internal team run the migration without outside help?
Often yes, if the team already runs Metabase and PostgreSQL and can follow the official procedure in a test environment first. The work requires someone who can create the target database and its role, run the Metabase JAR with the correct version and configuration, and confirm that logins, collections, questions and dashboards look right afterward. Teams with a single operator, no staging copy, or no tested rollback plan usually take more risk on the production night. An outside partner is useful when the team wants a fixed-scope rehearsal, a second pair of eyes on the checks, or help with the surrounding work such as backups and monitoring.
What does the migration need from our team?
The work needs four things from your side. First, database access: an administrator who can create the target PostgreSQL or MySQL database and a dedicated least-privilege account for Metabase. Second, backup storage: space and a tested location for a copy of the H2 file and a dump of the target database before and after the move. Third, a maintenance window agreed with the business owners who depend on Metabase. Fourth, the exact Metabase version currently running, since the load-from-h2 command must be run with the same version that last updated the H2 file. Confirm the version from the admin settings or the running JAR before scheduling anything.
Does moving off H2 change our licensing or edition needs?
No. Moving the application database does not change which Metabase edition you run or what it costs to run it. Features such as SSO, row and column level permissions, and usage analytics and auditing depend on the plan you hold, not on the database behind it. Check the pricing page and the plan you already have before the move, and confirm that any paid features you rely on are active in the migrated install. If you plan to add a paid plan later, that decision is separate from this migration and should be scoped on its own.
What should we do if load-from-h2 fails?
Stop, do not retry against the production target, and keep the original H2 file untouched. First, confirm the Metabase version matches the one that last updated the H2 file, because a mismatch is a common cause. Next, check the connection settings, database permissions and character set on the target, since MySQL and MariaDB need utf8mb4. Read the error output and the Metabase logs before changing anything. If the target is partly populated, restore it from your pre-move backup rather than patching it by hand. Keep a written rollback path so the team knows the exact restore steps before the window opens.
Can we upgrade Metabase right after the migration?
Wait until the migrated install passes your post-move checks before upgrading. Metabase runs application database migrations automatically during an upgrade, so take a fresh backup of the new PostgreSQL or MySQL database first. The upgrade documentation recommends reducing a cluster to a single node for major upgrades because of a migration lock, and upgrading release by release if your version is older than 40. Confirm the target version against the version support page, which lists long-term support releases and end-of-life dates, and keep the pre-upgrade backup as your rollback point.
How DeployOpen scopes, runs and hands over an H2 to PostgreSQL move
DeployOpen plans and carries out the move of a self-hosted Metabase application database from the embedded H2 file to PostgreSQL inside your own infrastructure. The work is agreed as a fixed scope with written deliverables, then built, tested and documented so your team can run the result.
How we scope
- Inventory the current Metabase version, the H2 file location and the exact JAR used to last update it.
- Agree the target PostgreSQL or MySQL instance, network path, credentials and backup location in writing.
- Confirm the maintenance window, rollback plan and who signs off the cutover before any work starts.
How we build
- Stage a copy of the H2 file and run load-from-h2 with the matching Metabase version in a non-production environment.
- Compare users, collections, questions, dashboards, permissions and data source connections before and after the load.
- Switch the production application database setting only after the staging run completes and the checks pass.
How we hand over
- Deliver a runbook covering backups taken, the commands used, the version pinned and the rollback steps.
- Document the post-switch checks, the owners of each check and the results recorded during the cutover.
- Walk your platform and security teams through the configuration, including database credential handling.
How we support
- Engagements are fixed-scope, so changes after go-live are scoped and quoted separately in writing.
- Ongoing support, version upgrades and continuous testing are available as a retainer after handover.
- Ask us to confirm the supported Metabase version path, since LTS and non-LTS windows affect the next upgrade.

