Home / Documentation / Architecture Guides / Backup Configuration

Backup Configuration

9 min read
Updated Jun 19, 2025

Backup Configuration

Implement comprehensive backup strategies to protect your data and ensure rapid recovery from any failure scenario.

Backup Strategy Overview

A robust backup strategy is essential for business continuity. This guide covers backup types, schedules, retention policies, and recovery procedures.

The 3-2-1 Rule

  • 3 copies of important data (1 primary + 2 backups)
  • 2 different storage media types
  • 1 offsite backup copy

Backup Types

Full Backup

  • Complete copy of all data
  • Fastest recovery time
  • Highest storage requirements
  • Typically scheduled weekly or monthly

Incremental Backup

  • Only changed data since last backup
  • Minimal storage requirements
  • Slower recovery (need full + all incrementals)
  • Ideal for daily backups

Differential Backup

  • Changed data since last full backup
  • Balanced storage and recovery time
  • Simpler recovery than incremental
  • Good for mid-week backups

Continuous Data Protection (CDP)

  • Real-time backup of changes
  • Near-zero RPO (Recovery Point Objective)
  • Point-in-time recovery capability
  • Higher infrastructure requirements

Database Backup Strategies

PostgreSQL Backup

Logical Backup with pg_dump:

# Full database backup
pg_dump -h localhost -U postgres -d mydb -f backup.sql

# Compressed backup
pg_dump -h localhost -U postgres -d mydb | gzip > backup.sql.gz

# Custom format with parallel jobs
pg_dump -h localhost -U postgres -d mydb -Fc -j 4 -f backup.dump

Physical Backup with pg_basebackup:

# Streaming backup with WAL
pg_basebackup -h localhost -U replicator -D /backup/pg_base -Fp -Xs -P

# Compressed tar format
pg_basebackup -h localhost -U replicator -D /backup/pg_base -Ft -z -Xs -P

MySQL Backup

Logical Backup with mysqldump:

# Single database
mysqldump -u root -p mydb > backup.sql

# All databases with routines
mysqldump -u root -p --all-databases --routines --triggers > full_backup.sql

# Consistent backup with single transaction
mysqldump -u root -p --single-transaction --master-data=2 mydb > backup.sql

Physical Backup with Percona XtraBackup:

# Full backup
xtrabackup --backup --target-dir=/backup/mysql/full

# Incremental backup
xtrabackup --backup --target-dir=/backup/mysql/inc1 \
  --incremental-basedir=/backup/mysql/full

MongoDB Backup

# Database dump
mongodump --host localhost --db mydb --out /backup/mongodb/

# Compressed archive
mongodump --host localhost --db mydb --gzip --archive=/backup/mydb.gz

# Point-in-time with oplog
mongodump --host localhost --oplog --out /backup/mongodb/

File System Backup

Linux Backup Tools

Tool Type Features Use Case
rsync File sync Incremental, compression, SSH Server replication
tar Archive Compression, preservation Full system backup
Restic Deduplication Encryption, snapshots Efficient storage
BorgBackup Deduplication Encryption, compression Large datasets

Rsync Examples

# Basic backup
rsync -av /source/ /backup/destination/

# Remote backup over SSH
rsync -avz -e ssh /source/ user@remote:/backup/

# Incremental with hard links
rsync -av --link-dest=/backup/previous /source/ /backup/current/

Snapshot-Based Backup

  • LVM Snapshots: Block-level snapshots for Linux
  • ZFS Snapshots: Copy-on-write filesystem snapshots
  • Btrfs Snapshots: Subvolume snapshots with send/receive
  • VMware Snapshots: Virtual machine state capture

Cloud Backup Solutions

AWS Backup

Automated Backup Configuration:

# Backup plan with AWS CLI
aws backup create-backup-plan --backup-plan '{
  "BackupPlanName": "DailyBackups",
  "Rules": [{
    "RuleName": "DailyRule",
    "TargetBackupVaultName": "Default",
    "ScheduleExpression": "cron(0 5 ? * * *)",
    "Lifecycle": {
      "DeleteAfterDays": 30,
      "MoveToColdStorageAfterDays": 7
    }
  }]
}'

Azure Backup

  • Azure Backup Server for on-premises
  • Azure Site Recovery for disaster recovery
  • Managed disk snapshots
  • Azure Files backup

Object Storage Backup

Provider Service Features
AWS S3 Glacier Low-cost archival, lifecycle policies
Azure Blob Archive Tiered storage, immutability
Google Cloud Storage Multi-regional, versioning
Backblaze B2 Cost-effective, S3 compatible

Backup Scheduling and Retention

Backup Schedule Example

Frequency Type Retention Storage Location
Hourly Incremental 24 hours Local fast storage
Daily Incremental 7 days Local + Remote
Weekly Full 4 weeks Remote storage
Monthly Full 12 months Cold storage
Yearly Full 7 years Archive storage

Automated Backup with Cron

# Crontab entries
# Hourly incremental
0 * * * * /scripts/backup-incremental.sh

# Daily at 2 AM
0 2 * * * /scripts/backup-daily.sh

# Weekly full backup on Sunday
0 3 * * 0 /scripts/backup-weekly-full.sh

# Monthly on the 1st
0 4 1 * * /scripts/backup-monthly.sh

Backup Verification and Testing

Verification Methods

  • Checksum verification: Ensure data integrity
  • Test restores: Regular recovery drills
  • Automated validation: Script-based verification
  • Backup reports: Daily status emails

Recovery Testing Schedule

  1. Monthly: Restore random files
  2. Quarterly: Full application recovery test
  3. Annually: Complete disaster recovery drill

Backup Monitoring

  • Success/failure notifications
  • Backup size trending
  • Completion time monitoring
  • Storage capacity alerts

Disaster Recovery Planning

Recovery Objectives

  • RTO (Recovery Time Objective): Maximum acceptable downtime
  • RPO (Recovery Point Objective): Maximum acceptable data loss
  • RCO (Recovery Capacity Objective): Minimum capacity after recovery

Recovery Procedures

  1. Assess damage and determine recovery scope
  2. Activate disaster recovery team
  3. Restore infrastructure (servers, network)
  4. Restore data from backups
  5. Verify application functionality
  6. Redirect traffic to recovered systems
  7. Document incident and lessons learned

Security Considerations

Backup Encryption

  • At-rest encryption: Encrypt backup files
  • In-transit encryption: Secure transfer protocols
  • Key management: Separate key storage
  • Access control: Limit backup access

Ransomware Protection

  • Immutable backups (WORM storage)
  • Air-gapped backup copies
  • Multi-factor authentication for backup systems
  • Regular security audits

Best Practices

  • Documentation: Maintain detailed recovery procedures
  • Automation: Minimize manual intervention
  • Monitoring: Alert on backup failures immediately
  • Testing: Regular recovery drills
  • Versioning: Keep multiple backup versions
  • Geographic distribution: Store backups in multiple locations
Note: This documentation is provided for reference purposes only. It reflects general best practices and industry-aligned guidelines, and any examples, claims, or recommendations are intended as illustrative—not definitive or binding.