Backup & Restore MariaDB
Zerops provides automated data backup for MariaDB services with full encryption and flexible management options.
For general backup information including configuration, scheduling, and management options, see the Zerops Backups documentation, which covers:
- Backup scheduling and retention policies
- Tagging system and storage quotas
- Manual backup creation and CLI tools
- Security and encryption details
This page focuses on MariaDB-specific backup details.
MariaDB Backup Format
MariaDB backups are created using mariabackup and stored in .xb.gz format:
- Format:
.xb.gz(single archive) - Tooling:
mariabackup - Compression: Uses
xbstreamformat, gzip compressed - Storage: Encrypted and stored in isolated object storage
Restoring MariaDB Backups
To restore a MariaDB backup, follow these steps:
If the backup is large and the export/import has higher demands, consider scaling up the RAM in the container before starting. You can use zsc to temporarily scale up:
Step 1: Deploy the restore helper service
Import the MariaDB restore recipe as a service into the project where your MariaDB service is located.
Use the zerops-import.yaml file from the repository to import the service. See the import documentation for details, or follow the steps in the recipe README.
Step 2: Get the backup download URL
- Navigate to your MariaDB service in the Zerops GUI
- Go to the Backups List & Configuration section
- Find the backup you want to restore
- Click the three dots menu (⋮) on that backup
- Select Copy download link
Step 3: Run the backup script
Connect to the mariadbrestore service using the GUI terminal or via VPN and SSH.
To use environment variables from your MariaDB service in the backup and restore commands, make sure the envIsolation project variable is set to none. See Environment Variable Isolation and Referencing Variables for details.
Run the backup script:
Verify the backup was created:
You can also verify the backup file exists by checking the File browser in the mariadbrestore service.
After the export completes, the terminal may become unresponsive. If this happens, refresh the terminal.
Step 4: Import data to the target database
Import the data to your target MariaDB database:
Alternatively, you can download the backup.sql dump file for later use or to restore to a database outside of Zerops.
High Availability
For MariaDB services running in High Availability mode:
- Backups are created on a randomly selected healthy node
- Other nodes remain operational during the backup process
- Manual backups typically run on the primary node
Best Practices
- Always create a manual backup with a protected tag before database migrations or major schema changes
- Test your restore process periodically in a non-production environment
- Monitor your backup storage usage in the Project Overview
- Use descriptive tags like
pre-migration-v2for important snapshots
For additional best practices and troubleshooting, refer to the main backup documentation.