Skip to content

Instantly share code, notes, and snippets.

@caleb15
Created November 22, 2019 19:04
Show Gist options
  • Save caleb15/9f27336a637aaf32e8fd27c04d2c80bc to your computer and use it in GitHub Desktop.
Save caleb15/9f27336a637aaf32e8fd27c04d2c80bc to your computer and use it in GitHub Desktop.
how to migrate docker metabase h2 to postgres
export MB_DB_TYPE=postgres
export MB_DB_PORT=5432
export MB_DB_USER=postgres
export MB_DB_PASS=
export MB_DB_HOST=db.metabase.staging
sudo docker cp metabase:/app/metabase.jar .
sudo docker stop metabase
java -jar metabase.jar load-from-h2 /home/metabase/metabase-data/metabase.db/metabase.db
# https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2
@caleb15
Copy link
Author

caleb15 commented Nov 22, 2019

metabase migration guide recommends stopping metabase before migrating but if you stop metabase while inside the docker container the container crashes (the container has to have it's main process running to work). So instead I copied the jar file out of the container and ran the migration outside.

This assumes that docker container has the h2 file mounted to /home/metabase/metabase-data/metabase.db/metabase.db

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment