Does anyone know how to save Metabase queries and dashboards? I am currently hosting Metabase on an instance on AWS Cloud Server and would like to know how I can save the queries in the event where if my instance stops, I can retrieve my dashboards and queries created.
@flamber does that mean that currently all my Metabase queries are stored in the H2 database? How do I then restore the data from the metabase.db.mv.db file?
Would anything happen if I’m using Metabase in production but did not migrate from the H2 database?
Do you know if I have to create a new cloud database instance (eg: Amazon RDS) for me to migrate my data in the H2 database into the RDS Postgresql instance? Is there any documentation on how can I do so?
Hi @flamber, I have created a Postgres RDS instance but how should I migrate to it? Do I need to create a new database in the instance first before the migration? In the migration guide, it mentions that I have to run the data migration command:
Do you know what do the username and password refer to? I entered the RDS database username and password but there was a prompt saying that it is an incorrect password.
EDIT: I created a separate instance to test out the migration and managed to migrate it to postgres but I’m not sure if I did it correctly because I followed the exact commands as above. Should the export MB_DB_HOST=localhost or should the host be my RDS host?
Do I have to run the migration command everytime I start Metabase? In other words, do I run this every time I reload Metabase (eg: If I do an update etc): export MB_DB_TYPE=postgres export MB_DB_DBNAME=metabase export MB_DB_PORT=5432 export MB_DB_USER=<username> export MB_DB_PASS=<password> export MB_DB_HOST=localhost java -jar metabase.jar load-from-h2 /path/to/metabase.db
Because I noticed that if I run java -jar metabase.jar, the application database changes to H2 again even though I have already migrated it to postgres
@hyo You migrate only once. Yes, you need to use the exact same credentials in the environment variables for your RDS as you would if you tried to connect to your RDS with any other program, so you need to change host.
After you have migrated, then you need to start Metabase with variables, so it points to your new application database: https://www.metabase.com/docs/latest/operations-guide/configuring-application-database.html
Thanks @flamber. I have successfully migrated to postgresql but I’m not sure if I did it correctly as I am still facing 2 issues:
Immediately after the migration to postgres is completed, when I run java -jar metabase.jar, Metabase starts up correctly and under the diagnostic info, the application database is postgres.
But if I shutdown Metabase and restart Metabase using export MB_DB_CONNECTION_URI="postgres://localhost:5432/metabase?user=<username>&password=<password>", the application database changes back to h2…
@hyo No, it’s placeholders. If your username/password is THIS-IS-MY-INPUT, then it would look like this: java -DMB_DB_CONNECTION_URI="postgres://localhost:5432/metabase?user=THIS-IS-MY-INPUT&password=THIS-IS-MY-INPUT" -jar metabase.jar