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.
Always create a backup before running curio toolbox downgrade or performing any major cluster operations. Database schema changes during upgrades may not be reversible without a backup.
Prerequisites
Access to your YugabyteDB cluster
The
ysql_dumpandysqlshutilities (included with YugabyteDB installation)Sufficient disk space for backup files
Backup Methods
Method 1: Using ysql_dump (Recommended)
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).dumpParameters:
-h: YugabyteDB host address-p: YSQL port (default: 5433)-U: Database username-d: Database name (typicallycurioor 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
Ensure all Curio nodes are stopped before restoring a backup.
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
Regular Backups: Schedule automated daily backups, especially for production clusters
Test Restores: Periodically verify your backups by performing test restores
Off-site Storage: Store backup copies in a different location or cloud storage
Pre-upgrade Backups: Always create a fresh backup before upgrading or downgrading Curio
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