Backup & Restore Metadata
Introduction
Before upgrading your OpenMetadata version we strongly recommend backing up the metadata.
The source of truth is stored in the underlying database (MySQL and Postgres supported). During each version upgrade there is a database migration process that needs to run. It will make changes to the OpenMetadata Application schema in the database and update the shape of the data to the newest OpenMetadata release.
It is important that we backup the data because if we face any unexpected issues during the upgrade process, you will be able to get back to the previous version without any loss.
You can learn more about how the migration process works here.
Since version 1.4.0, OpenMetadata encourages using the builtin-tools for creating logical backups of the metadata:
For PROD deployments we recommend relying on managed cloud databases such as AWS RDS, Azure SQL or GCP Cloud SQL.
If you're a user of these services, you can leverage their backup capabilities directly:
Requirements
mysqldump8.3 or higherpg_dump13.3 or higher
You do not need to run the OpenMetadata docker-compose stack or the ingestion container to take backups. The examples below use a temporary docker run container that invokes the DB client directly.
Storing the backup files
It's important that when you backup your database, you keep the snapshot safe in case you need in later.
You can check these two examples on how to:
- Use pipes to stream the result directly to S3 (or AWS blob storage) (link).
- Dump to a file and copy to storage (link).
Backup & Restore Examples (Recommended)
These examples assume your OpenMetadata metadata database is accessible on the network from the machine where you are running the commands.
There is no need to start OpenMetadata or docker-compose.
MySQL
1. Backup
Replace <mysql_host> with your MySQL hostname (e.g., mysql, RDS endpoint, etc.).
The MySQL server does not need to run in docker; only the mysqldump client runs via docker.
2. Restore
PostgreSQL
1. Backup
You must pass the password via PGPASSWORD env variable.
Replace <postgres_host> with your Postgres hostname.