Skip to content

[toygres] Backup and restore support #27

Description

@affandar

Repository

affandar/toygres

Backup Types

  • Full: Base backup via pg_basebackup
  • Incremental: WAL archiving since last backup
  • Logical: pg_dump for specific databases

Backup API

// Manual backup
let backup = client.create_backup(CreateBackupRequest {
    instance_id: "pg-prod-1".into(),
    backup_type: BackupType::Full,
    label: Some("pre-migration-backup".into()),
}).await?;

// Schedule automatic backups
client.configure_backup_schedule(BackupScheduleConfig {
    instance_id: "pg-prod-1".into(),
    full_backup_cron: "0 2 * * 0".into(),  // Weekly
    incremental_backup_cron: "0 2 * * *".into(),  // Daily
}).await?;

Restore API

// Restore to new instance
client.restore_backup(RestoreRequest {
    backup_id: "backup-123".into(),
    target: RestoreTarget::NewInstance { instance_id: "pg-restored".into() },
    point_in_time: Some(datetime),  // PITR support
}).await?;

Storage Options

  • Azure Blob Storage
  • S3
  • Local filesystem

Retention Policy

  • Keep daily backups for N days
  • Keep weekly backups for N weeks
  • Keep monthly backups for N months

Point-in-Time Recovery (PITR)

  • Continuous WAL archiving
  • Restore base backup + replay WAL to target timestamp

See: proposals/toygres-improvements.md

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions