The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
docs - notes on loading app db from snapshot (#83802)
Jeff Bruemmer6e83a22e3c3e
diff --git a/docs/cloud/migrate/cloud-to-self-hosted.md b/docs/cloud/migrate/cloud-to-self-hosted.mdindex 66f421092ce..637f837be7c 100644--- a/docs/cloud/migrate/cloud-to-self-hosted.md+++ b/docs/cloud/migrate/cloud-to-self-hosted.md@@ -52,12 +52,44 @@ If you're migrating from a Metabase Cloud Pro plan to a self-hosted Pro plan, yoSnapshots expire quickly, but don't sweat it; if your snapshot has expired, just request a new one.-3. **Import your application data into your self-hosted application database**. Follow the instructions to [migrate from H2 to a production application database](../../installation-and-operation/migrating-from-h2.md) using the `.mv.db` snapshot you downloaded.+3. **Load the snapshot into your self-hosted application database**. Run the `load-from-h2` command to copy the data from the `.mv.db` snapshot into your self-hosted application database.- The migration will involve running a CLI command to load the data from the H2 snapshot you downloaded to your self-hosted application database.+ Before you run the command, make sure that:++ - Your Metabase JAR is the [same version as your Metabase Cloud instance](#version-of-self-hosted-metabase-should-match-cloud-version).+ - You can connect to your self-hosted application database from the computer where you'll run the command.+ - Your self-hosted application database is empty. If you've already started your self-hosted Metabase with this database and created an account, the command will fail with a `Target DB is already populated!` error.++ Set the [environment variables](../../configuring-metabase/environment-variables.md) for your application database, then run the command. For example, for a PostgreSQL application database:++ ```+ export MB_DB_TYPE=postgres+ export MB_DB_CONNECTION_URI="jdbc:postgresql://<host>:5432/metabase?user=<username>&password=<password>"+ java --add-opens java.base/java.nio=ALL-UNNAMED -jar metabase.jar load-from-h2 /path/to/metabase.db+ ```++ Use the path to your snapshot file _without_ the `.mv.db` extension. For example, if your snapshot file is `/path/to/metabase.db.mv.db`, use `/path/to/metabase.db`.++ For MySQL or MariaDB, or to set the connection details with separate variables, see [Configuring the application database](../../installation-and-operation/configuring-application-database.md).++ Metabase will create the tables in your application database, copy the data from the snapshot, and then exit.++ If you run Metabase in Docker, [download the JAR](https://github.com/metabase/metabase/releases) for the same version and run the command _outside_ the container. See [Docker: how to migrate from H2](../../installation-and-operation/migrating-from-h2.md#docker-how-to-migrate-from-h2-to-your-production-application-database).If you encounter any issues, check out the [troubleshooting guide](../../troubleshooting-guide/loading-from-h2.md) or [contact us](https://www.metabase.com/help-premium).-4. **Pro plans will need to input a license token to activate the paid features**. If you're migrating to a Pro self-hosted plan, [activate your Enterprise Edition token](../../installation-and-operation/activating-the-enterprise-edition.md).+4. **Start your self-hosted Metabase**. Use the same application database environment variables, but leave out the `load-from-h2` command:++ ```+ export MB_DB_TYPE=postgres+ export MB_DB_CONNECTION_URI="jdbc:postgresql://<host>:5432/metabase?user=<username>&password=<password>"+ java --add-opens java.base/java.nio=ALL-UNNAMED -jar metabase.jar+ ```++ If you run Metabase in Docker, start a new container with the same application database settings. See [Start a new Docker container that uses the new app db](../../installation-and-operation/migrating-from-h2.md#6-start-a-new-docker-container-that-uses-the-new-app-db).++ Keep your snapshot file until you've confirmed that your self-hosted Metabase has all your data.++5. **Pro plans will need to input a license token to activate the paid features**. If you're migrating to a Pro self-hosted plan, [activate your Enterprise Edition token](../../installation-and-operation/activating-the-enterprise-edition.md).If you're on a Pro Cloud plan, you'll need to cancel that plan and start a new self-hosted Pro plan to get the token you'll need to activate your paid features. See [Preparing to migrate from cloud to self-hosted](#preparing-to-migrate-from-cloud-to-self-hosted).