Rounak Dhillon f696227ead
Doc: SEO Title Updation (#21842)
* Doc: SEO Title Updation

* Doc: Data Discovery Gif Updation

* Doc: SEO title updation

* Doc: SEO Title Updation

---------

Co-authored-by: “Rounak <“rounakpreet.d@deuexsolutions.com”>
2025-06-20 07:16:38 -07:00

4.8 KiB

title slug collate
Backup Metadata | OpenMetadata Deployment Guide /deployment/backup-restore-metadata false

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 directly attack your 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.

{% note %}

You can learn more about how the migration process works here.

{% /note %}

Since version 1.4.0, OpenMetadata encourages using the builtin-tools for creating logical backups of the metadata:

For PROD deployment we recommend users to rely on cloud services for their databases, be it AWS RDS, Azure SQL or GCP Cloud SQL.

If you're a user of these services, you can leverage their backup capabilities directly:

Requirements

  • mysqldump 8.3 or higher
  • pg_dump 13.3 or higher

If you're running the project using docker compose, the ingestion container already comes packaged with the correct mysqldump and pg_dump versions ready to use.

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).

Example with Docker

Start a local instance of OpenMetadata using the docker-compose file provided in the repository. Then, we can use the following commands to backup the metadata:

MySQL

1. Start a local docker deployment

docker/run_local_docker.sh

Ingest some data...

2. Backup and Restore

BACKUP_FILE="backup_$(date +%Y%m%d%H%M).sql"
export COMPOSE_FILE="docker/development/docker-compose.yml"
# backup
docker compose exec ingestion mysqldump --no-tablespaces -u openmetadata_user -popenmetadata_password -h mysql -P 3306 openmetadata_db > $BACKUP_FILE
# create the restore database
docker compose exec mysql  mysql -u root -ppassword -e "create database restore;"
docker compose exec mysql  mysql -u root -ppassword -e "grant all privileges on restore.* to 'openmetadata_user'@'%';"
docker compose exec mysql  mysql -u root -ppassword -e "GRANT SUPER, SYSTEM_VARIABLES_ADMIN, SESSION_VARIABLES_ADMIN ON *.* TO 'openmetadata_user'@'%';"
docker compose exec mysql  mysql -u root -ppassword -e "flush privileges;"
# restore from the backup
docker compose exec -T ingestion mysql -u openmetadata_user -popenmetadata_password -h mysql -P 3306 restore < $BACKUP_FILE

3. Restart the docker deployment with the restored database

export OM_DATABASE=restore
docker compose -f $DOCKER_COMPOSE_FILE up -d

PostgreSQL

1. Start a local docker deployment

docker/run_local_docker.sh -d postgres

Ingest some data...

2. Backup and Restore

BACKUP_FILE="backup_$(date +%Y%m%d%H%M).sql"
export COMPOSE_FILE="docker/development/docker-compose-postgres.yml"
# backup
docker compose exec -e PGPASSWORD=openmetadata_password ingestion pg_dump -U openmetadata_user -h postgresql -d openmetadata_db > $BACKUP_FILE
# create the restore database
docker compose exec -e PGPASSWORD=openmetadata_password postgresql psql -U postgres -c "create database restore;"
docker compose exec -e PGPASSWORD=openmetadata_password postgresql psql -U postgres -c "ALTER DATABASE restore OWNER TO openmetadata_user;"
# restore from the backup
docker compose exec -e PGPASSWORD=openmetadata_password -T ingestion psql -U openmetadata_user -h postgresql -d restore < $BACKUP_FILE

3. Restart the docker deployment with the restored database

export OM_DATABASE=restore
docker compose -f $DOCKER_COMPOSE_FILE up -d