Skip to main content

Backup & Restore

Strategi backup dan recovery untuk database MySQL di MStore Backend, mencakup full backup, incremental backup, dan point-in-time recovery.

🎯 Backup Strategy

Backup Types

Backup Tools

Primary: mysqldump
Alternative: Percona XtraBackup
Cloud: AWS RDS Snapshots

πŸ“‹ Backup Scheduling

Daily Backup Schedule

Backup Retention Policy

Automated Backup Script

Cron Job


πŸ”„ Restore Procedures

Full Restore (Complete Database)

Selective Restore (Specific Table)

Point-in-Time Recovery (PITR)

Restore from AWS RDS Snapshot


βœ… Backup Verification

Verify Backup Integrity

Backup Monitoring


🚨 Disaster Recovery Plan

Recovery Time Objective (RTO)

  • Full backup restore: 30 minutes
  • Incremental restore: 15 minutes
  • PITR restore: 10 minutes

Recovery Point Objective (RPO)

  • Maximum data loss: 1 hour (hourly incremental backups)

Recovery Steps

  1. Assess Damage
    • Identify what data is corrupted/lost
    • Determine recovery point needed
    • Notify stakeholders
  2. Stop Application
  3. Backup Current Database (for forensics)
  4. Restore from Backup
  5. Verify Data Integrity
  6. Restart Application
  7. Monitor Logs

πŸ“Š Backup Checklist

Pre-Backup

  • Verify backup disk space
  • Check database connectivity
  • Verify backup script permissions
  • Test backup on staging
  • Notify team of maintenance window

During Backup

  • Monitor backup progress
  • Check CPU/disk usage
  • Verify no application errors
  • Monitor network bandwidth

Post-Backup

  • Verify backup file integrity
  • Verify backup file size (should be reasonable)
  • Upload to S3/cloud storage
  • Test restore on staging
  • Document backup completion
  • Update backup log

πŸš€ Best Practices

DO βœ…

  • Backup regularly (daily minimum)
  • Test restores on staging
  • Keep backups off-site (S3, cloud)
  • Encrypt backups at rest
  • Monitor backup completion
  • Document recovery procedures
  • Use automated backup scripts
  • Maintain backup retention policy
  • Verify backup integrity regularly

DON’T ❌

  • Skip backup testing
  • Store backups only locally
  • Use unencrypted backups
  • Backup during peak hours
  • Ignore backup failures
  • Keep backups forever (cost)
  • Restore to production without testing
  • Forget to document recovery steps

MySQL Migrations

Migration strategy

Data Seeding

Seed data strategy

MySQL Schema

Complete schema reference

DevOps

DevOps procedures