YugabyteDB Backup

How to backup and restore your YugabyteDB database for Curio

Maintaining regular backups of your YugabyteDB database is critical for disaster recovery and before performing operations like software downgrades. This guide covers the essential backup and restore procedures for your Curio cluster's database.

Prerequisites

  • Access to your YugabyteDB cluster

  • The ysql_dump and ysqlsh utilities (included with YugabyteDB installation)

  • Sufficient disk space for backup files

Backup Methods

The ysql_dump utility creates a logical backup of your database that can be restored to any YugabyteDB cluster.

Full Database Backup

ysql_dump -h <yugabyte-host> -p 5433 -U <username> -d <database> -F c -f curio_backup_$(date +%Y%m%d_%H%M%S).dump

Parameters:

  • -h: YugabyteDB host address

  • -p: YSQL port (default: 5433)

  • -U: Database username

  • -d: Database name (typically curio or your configured database name)

  • -F c: Custom format (compressed, supports parallel restore)

  • -f: Output filename

Example with typical Curio configuration

Schema-Only Backup

To backup only the database schema without data:

Method 2: Using ysqlsh with COPY

For smaller databases or specific tables:

Restore Procedures

Restore from ysql_dump backup

Full Restore

Restore from SQL dump

Automated Backup Script

Create a backup script for regular automated backups:

Make the script executable and add it to cron:

Best Practices

  1. Regular Backups: Schedule automated daily backups, especially for production clusters

  2. Test Restores: Periodically verify your backups by performing test restores

  3. Off-site Storage: Store backup copies in a different location or cloud storage

  4. Pre-upgrade Backups: Always create a fresh backup before upgrading or downgrading Curio

  5. Monitor Backup Size: Track backup sizes to ensure adequate storage capacity

Troubleshooting

Connection Issues

If you encounter connection errors:

Permission Errors

Ensure your database user has sufficient privileges:

Additional Resources

Last updated