MySQL Backup Service is a Python program automating MySQL backups on Google Cloud Platform
MySQL Backup Service is a Python program automating MySQL backups on Google Cloud Platform.
The application requires several configuration parameters to be set up before using:
After you set up all the parameters described you need to set up GCP services:
After that grant all the required roles to the user which will be used for running MySQL Backup Service:
To test MySQL Backup Service execute the following steps:
gcloud
:
gcloud auth login
gcloud auth application-default login
pip install poetry
poetry install -v
export PROJECT_ID=<PROJECT_ID>
export DATABASE_HOST=<DATABASE_HOST>
export DATABASE_SCHEMA=<DATABASE_SCHEMA>
export DATABASE_USER=<DATABASE_USER>
export DATABASE_PASSWORD_SECRET_NAME=<DATABASE_PASSWORD_SECRET_NAME>
export SUBSCRIPTION_NAME=<SUBSCRIPTION_NAME>
export BUCKET_NAME=<BUCKET_NAME>
python -m gcp_mysql_backup_service run --logging-config config/logging-config.yml
gcloud pubsub topics publish mysql-backup-service --message=test
gcp_mysql_backup_service.backup - INFO - Start creating a employees.sql backup
gcp_mysql_backup_service.backup - INFO - Backup has been successfully saved to employees.sql
gcp_mysql_backup_service.storage - INFO - Started uploading employees.sql to d6c437d0-2fa0-43da-bb84-65fb3ccfa371-mysql-backup-service bucket
gcp_mysql_backup_service.storage - INFO - Started uploading employees.sql as employees_2020_06_01_03_00.sql blob to d6c437d0-2fa0-43da-bb84-65fb3ccfa371-mysql-backup-service bucket
gcp_mysql_backup_service.storage - INFO - File employees.sql has been successfully uploaded to d6c437d0-2fa0-43da-bb84-65fb3ccfa371-mysql-backup-service bucket as employees_2020_06_01_03_00.sql
gsutil ls gs://d6c437d0-2fa0-43da-bb84-65fb3ccfa371-mysql-backup-service/gs://d6c437d0-2fa0-43da-bb84-65fb3ccfa371-mysql-backup-service/employees_2020_06_01_03_00.sql