# 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](/features/backup) 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 `xbstream` format, gzip compressed - **Storage**: Encrypted and stored in isolated object storage ## Restoring MariaDB Backups To restore a MariaDB backup, follow these steps: :::tip 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](/references/zsc) to temporarily scale up: ```bash zsc scale ram +2GB 10m ``` ::: ### Step 1: Deploy the restore helper service Import the [MariaDB restore recipe](https://github.com/zeropsio/recipe-mariadb-restore) 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](/references/import) for details, or follow the steps in the [recipe README](https://github.com/zeropsio/recipe-mariadb-restore?tab=readme-ov-file#deploy-on-zerops). ### Step 2: Get the backup download URL 1. Navigate to your MariaDB service in the Zerops GUI 2. Go to the **Backups List & Configuration** section 3. Find the backup you want to restore 4. Click the **three dots menu** (⋮) on that backup 5. Select **Copy download link** ### Step 3: Run the backup script Connect to the `mariadbrestore` service using the GUI terminal or via [VPN](/references/networking/vpn) and [SSH](/references/networking/ssh). :::note 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](/features/env-variables#environment-variable-isolation) and [Referencing Variables](/features/env-variables#referencing-variables) for details. ::: Run the backup script: ```bash backup.sh -d -u "" ``` Verify the backup was created: ```bash ls -lh backup.sql ``` :::note You can also verify the backup file exists by checking the **File browser** in the `mariadbrestore` service. ::: :::info 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: ```bash mariadb -u -h -p < backup.sql ``` 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-v2` for important snapshots For additional best practices and troubleshooting, refer to the [main backup documentation](/features/backup).