2024-12-06 18:27:25 +01:00
|
|
|
---
|
|
|
|
|
title: Azure Blob storage
|
|
|
|
|
layout: default
|
|
|
|
|
parent: How Tos
|
|
|
|
|
nav_order: 5
|
|
|
|
|
---
|
|
|
|
|
|
2025-01-13 14:40:46 +01:00
|
|
|
# Backup to Azure Blob Storage
|
2024-12-06 18:27:25 +01:00
|
|
|
|
2025-01-13 14:40:46 +01:00
|
|
|
To store your backups on Azure Blob Storage, you can configure the backup process to use the `--storage azure` option.
|
2024-12-06 18:27:25 +01:00
|
|
|
|
2025-01-13 14:40:46 +01:00
|
|
|
This section explains how to set up and configure Azure Blob-based backups.
|
2024-12-06 18:27:25 +01:00
|
|
|
|
2025-01-13 14:40:46 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Configuration Steps
|
|
|
|
|
|
|
|
|
|
1. **Specify the Storage Type**
|
|
|
|
|
Add the `--storage azure` flag to your backup command.
|
|
|
|
|
|
|
|
|
|
2. **Set the Blob Path**
|
|
|
|
|
Optionally, specify a custom folder within your Azure Blob container where backups will be stored using the `--path` flag.
|
|
|
|
|
Example: `--path my-custom-path`.
|
|
|
|
|
|
|
|
|
|
3. **Required Environment Variables**
|
|
|
|
|
The following environment variables are mandatory for Azure Blob-based backups:
|
|
|
|
|
|
|
|
|
|
- `AZURE_STORAGE_CONTAINER_NAME`: The name of the Azure Blob container where backups will be stored.
|
|
|
|
|
- `AZURE_STORAGE_ACCOUNT_NAME`: The name of your Azure Storage account.
|
|
|
|
|
- `AZURE_STORAGE_ACCOUNT_KEY`: The access key for your Azure Storage account.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Example Configuration
|
|
|
|
|
|
|
|
|
|
Below is an example `docker-compose.yml` configuration for backing up to Azure Blob Storage:
|
|
|
|
|
|
|
|
|
|
```yaml
|
2024-12-06 18:27:25 +01:00
|
|
|
services:
|
|
|
|
|
mysql-bkup:
|
2025-01-13 14:40:46 +01:00
|
|
|
# In production, lock your image tag to a specific release version
|
|
|
|
|
# instead of using `latest`. Check https://github.com/jkaninda/mysqlbkup/releases
|
|
|
|
|
# for available releases.
|
2024-12-06 18:27:25 +01:00
|
|
|
image: jkaninda/mysql-bkup
|
|
|
|
|
container_name: mysql-bkup
|
2024-12-06 18:33:54 +01:00
|
|
|
command: backup --storage azure -d database --path my-custom-path
|
2024-12-06 18:27:25 +01:00
|
|
|
environment:
|
|
|
|
|
- DB_PORT=3306
|
|
|
|
|
- DB_HOST=mysql
|
|
|
|
|
- DB_NAME=database
|
|
|
|
|
- DB_USERNAME=username
|
|
|
|
|
- DB_PASSWORD=password
|
2025-01-13 14:40:46 +01:00
|
|
|
## Azure Blob Configuration
|
2024-12-06 18:27:25 +01:00
|
|
|
- AZURE_STORAGE_CONTAINER_NAME=backup-container
|
|
|
|
|
- AZURE_STORAGE_ACCOUNT_NAME=account-name
|
|
|
|
|
- AZURE_STORAGE_ACCOUNT_KEY=Ppby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
|
2025-01-13 14:40:46 +01:00
|
|
|
|
|
|
|
|
# Ensure the mysql-bkup container is connected to the same network as your database
|
2024-12-06 18:27:25 +01:00
|
|
|
networks:
|
|
|
|
|
- web
|
2025-01-13 14:40:46 +01:00
|
|
|
|
2024-12-06 18:27:25 +01:00
|
|
|
networks:
|
|
|
|
|
web:
|
|
|
|
|
```
|
|
|
|
|
|
2025-01-13 14:40:46 +01:00
|
|
|
---
|
2024-12-06 18:27:25 +01:00
|
|
|
|
2025-01-13 14:40:46 +01:00
|
|
|
## Key Notes
|
2024-12-06 18:27:25 +01:00
|
|
|
|
2025-01-13 14:40:46 +01:00
|
|
|
- **Custom Path**: Use the `--path` flag to specify a folder within your Azure Blob container for organizing backups.
|
|
|
|
|
- **Security**: Ensure your `AZURE_STORAGE_ACCOUNT_KEY` is kept secure and not exposed in public repositories.
|
|
|
|
|
- **Compatibility**: This configuration works with Azure Blob Storage and other compatible storage solutions.
|