Shared-Console-stg-DB-restore¶
Imported from Confluence
Content may be outdated. Verify before following any procedures. View original | Last updated: August 2025
Console Database Restore from exchange GCS Dump¶
This script automatically restores MySQL databases for console-stg from the latest backup stored in Google Cloud Storage (here).
What it does¶
- Finds the latest backup file by date from GCS bucket
- Downloads the backup to local storage /data/backup/
- Stops MySQL service
- Cleans MySQL data directory (
/data/mysql/\*) - Extracts backup files to
/data/mysql/ - Sets proper permissions and restarts MySQL
- Also tunned mysql conf (etc/mysql/mysql.conf.d/mysqld.cnf) file is here
Usage¶
If you need to run the restore process manually
# Connect to the VM
gcloud compute ssh --zone "us-east1-c" "vm-mysql-console-stg-prod-us-east1-0" --tunnel-through-iap --project "agp-shared-prod-o0"
### Run Manually this script to start restore process
./data/scripts/restore-from-gcs.sh
Automated execution (Cron)¶
Cron is already scheduled in the VM. To access and check the schedule:
# Connect to the VM
gcloud compute ssh --zone "us-east1-c" "vm-mysql-console-stg-prod-us-east1-0" --tunnel-through-iap --project "agp-shared-prod-o0"
# Check current cron schedule
crontab -l
# View restore logs
tail -f /var/log/restore-backup.log
Current schedule: Every Saturday at 1 AM
Cron entry: 0 1 \* \* 6 /data/scripts/restore-from-gcs.sh >> /var/log/restore-backup.log 2>&1
Note: Process takes ~2 hours to complete, finishing around 3 AM before business hours.