I'm trying to configure my CloudnativePG cluster to back up to S3 every day and to Azure blob storage once a week. However, I only see a single backup configuration option in the manifest file. Is there a way to set up multiple backup targets within CloudnativePG? Or would I need to create an external script to transfer the backups from S3 to Azure?
4 Answers
You can definitely check out the external cluster configuration for this. Using a two-pronged approach with S3 for daily backups and Azure for your weekly ones is achievable. Just configure it properly in your manifest like this example:
```
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: postgres-cluster
spec:
instances: 3
backup:
barmanObjectStore:
destinationPath: "s3://your-s3-bucket/daily-backups"
retentionPolicy: "30d"
s3Credentials: {...}
externalClusters:
- name: weekly-azure-backup
barmanObjectStore:
destinationPath: "azure://your-container/weekly-backups"
azureCredentials: {...}
```
Make sure you adjust the paths and credentials accordingly!
Another approach could be to replicate S3 or set up a replicated standby cluster that has its own backup configuration. This way, you can manage backups more efficiently across both environments.
You might have better luck discussing this in the CNCF Slack CNPG channel. Backups are transitioning to a plug-in architecture, and it may soon support multiple targets. Just make sure you're using version 1.26 of the operator, and keep an eye out for any open issues. But I'd hold off on implementing this in production for now.
Setting up replication on your S3 storage could be an option, but remember, replication isn't the same as backups. If you're just looking to copy the backups weekly from S3 to Azure, that can be easily handled by a script.
Thanks for the tip!