Docs: Updating the Backup docs (#20977)

Co-authored-by: Prajwal Pandit <prajwalpandit@Prajwals-MacBook-Air.local>
This commit is contained in:
Prajwal214 2025-04-25 13:46:19 +05:30 committed by GitHub
parent 3d6810f83f
commit e181c50e50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 207 additions and 3 deletions

View File

@ -51,3 +51,71 @@ It's important that when you backup your database, you keep the snapshot safe in
You can check these two examples on how to:
- Use pipes to stream the result directly to S3 (or AWS blob storage) ([link](https://devcoops.com/pg_dump-to-s3-directly/?utm_content=cmp-true)).
- Dump to a file and copy to storage ([link](https://gist.github.com/bbcoimbra/0914c7e0f96e8ad53dfad79c64863c87)).
# 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
```shell
docker/run_local_docker.sh
```
Ingest some data...
### 2. Backup and Restore
```shell
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
```shell
export OM_DATABASE=restore
docker compose -f $DOCKER_COMPOSE_FILE up -d
```
## PostgreSQL
### 1. Start a local docker deployment
```shell
docker/run_local_docker.sh -d postgres
```
Ingest some data...
### 2. Backup and Restore
```shell
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
```shell
export OM_DATABASE=restore
docker compose -f $DOCKER_COMPOSE_FILE up -d
```

View File

@ -6,7 +6,7 @@ collate: false
# Upgrade OpenMetadata
In this guide, you will find all the necessary information to safely upgrade your OpenMetadata instance to 1.3.x.
In this guide, you will find all the necessary information to safely upgrade your OpenMetadata instance to 1.6.x.
{% partial file="/v1.6/deployment/upgrade/upgrade-prerequisites.md" /%}

View File

@ -51,3 +51,71 @@ It's important that when you backup your database, you keep the snapshot safe in
You can check these two examples on how to:
- Use pipes to stream the result directly to S3 (or AWS blob storage) ([link](https://devcoops.com/pg_dump-to-s3-directly/?utm_content=cmp-true)).
- Dump to a file and copy to storage ([link](https://gist.github.com/bbcoimbra/0914c7e0f96e8ad53dfad79c64863c87)).
# 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
```shell
docker/run_local_docker.sh
```
Ingest some data...
### 2. Backup and Restore
```shell
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
```shell
export OM_DATABASE=restore
docker compose -f $DOCKER_COMPOSE_FILE up -d
```
## PostgreSQL
### 1. Start a local docker deployment
```shell
docker/run_local_docker.sh -d postgres
```
Ingest some data...
### 2. Backup and Restore
```shell
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
```shell
export OM_DATABASE=restore
docker compose -f $DOCKER_COMPOSE_FILE up -d
```

View File

@ -6,7 +6,7 @@ collate: false
# Upgrade OpenMetadata
In this guide, you will find all the necessary information to safely upgrade your OpenMetadata instance to 1.3.x.
In this guide, you will find all the necessary information to safely upgrade your OpenMetadata instance to 1.7.x.
{% partial file="/v1.7/deployment/upgrade/upgrade-prerequisites.md" /%}

View File

@ -51,3 +51,71 @@ It's important that when you backup your database, you keep the snapshot safe in
You can check these two examples on how to:
- Use pipes to stream the result directly to S3 (or AWS blob storage) ([link](https://devcoops.com/pg_dump-to-s3-directly/?utm_content=cmp-true)).
- Dump to a file and copy to storage ([link](https://gist.github.com/bbcoimbra/0914c7e0f96e8ad53dfad79c64863c87)).
# 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
```shell
docker/run_local_docker.sh
```
Ingest some data...
### 2. Backup and Restore
```shell
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
```shell
export OM_DATABASE=restore
docker compose -f $DOCKER_COMPOSE_FILE up -d
```
## PostgreSQL
### 1. Start a local docker deployment
```shell
docker/run_local_docker.sh -d postgres
```
Ingest some data...
### 2. Backup and Restore
```shell
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
```shell
export OM_DATABASE=restore
docker compose -f $DOCKER_COMPOSE_FILE up -d
```

View File

@ -6,7 +6,7 @@ collate: false
# Upgrade OpenMetadata
In this guide, you will find all the necessary information to safely upgrade your OpenMetadata instance to 1.3.x.
In this guide, you will find all the necessary information to safely upgrade your OpenMetadata instance to 1.7.x.
{% partial file="/v1.8/deployment/upgrade/upgrade-prerequisites.md" /%}