Skip to content
Snippets Groups Projects
Commit cbde8f3f authored by Joshua Short's avatar Joshua Short
Browse files

Add instructions for migrating from H2 to another database container

parent c755b22b
No related branches found
No related tags found
No related merge requests found
......@@ -69,7 +69,33 @@ In this scenario all you need to do is make sure you launch Metabase with the co
Keep in mind that Metabase will be connecting from within your docker container, so make sure that either you're using a fully qualified hostname or that you've set a proper entry in your container's `/etc/hosts file`.
See instructions for [migrating from H2 to MySQL or Postgres](./start.md#migrating-from-using-the-h2-database-to-mysql-or-postgres).
### Migrating from H2 to Postgres as the Metabase application database
For general information, see instructions for [migrating from H2 to MySQL or Postgres](./start.md#migrating-from-using-the-h2-database-to-mysql-or-postgres).
To migrate an existing Metabase container from an H2 application database to another database container (e.g. Postgres, MySQL), there are a few considerations to keep in mind:
* The target database container must be accessible (i.e. on an available network)
* The target database container must be supported (e.g. MySQL, Postgres)
* The existing H2 storage should be mapped outside the running container (refer to the [Docker guide](http://www.metabase.com/docs/latest/operations-guide/running-metabase-on-docker.html#mounting-a-mapped-file-storage-volume) for more information)
The migration process involves 2 main steps:
* Stop the existing Metabase container
* Run a new, temporary Metabase container to perform the migration
Using a Postgres container as the target, here's an example invocation:
docker run
-v /path/metabase/data:/metabase-data \
-e "MB_DB_TYPE=postgres" \
-e "MB_DB_DBNAME=metabase" \
-e "MB_DB_PORT=5432" \
-e "MB_DB_USER=<username>" \
-e "MB_DB_PASS=<password>" \
-e "MB_DB_HOST=my-database-host" \
-e "MB_DB_FILE=/metabase-data/metabase.db" \
--name metabase-migration metabase/metabase load-from-h2
### Setting the Java Timezone
......@@ -103,12 +129,12 @@ The DB contents will be left in a directory named metabase.db.
Note that some older versions of metabase stored their db in a different default location.
docker cp CONTAINER_ID:/metabase.db.mv.db metabase.db.mv.db
### Fixing OutOfMemoryErrors in some hosted environments
On some hosts Metabase can fail to start with an error message like:
java.lang.OutOfMemoryError: Java heap space
If that happens, you'll need to set a JVM option to manually configure the maximum amount of memory the JVM uses for the heap. Refer
to [these instructions](./start.md#metabase-fails-to-start-due-to-heap-space-outofmemoryerrors) for details on how to do that.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment