Wednesday, March 27, 2019
CosmosDB Backup options
Azure CosmosDB is a managed database and It does not let you backup your databases manually. This does not mean that you don't have backups. Microsoft automatically backups all your CosmosDB databases every 4 hours. Only the two latest backups are stored. If your container or database is deleted, Azure Cosmos DB still can restore your database or container since they retains the snapshots of containers and databases for 30 days.
CosmosDB uses Azure Blob storage in the same region as your database's write region for backups. If you have multiple write regions, CosmosDB picks one of them to store your backups. But wait, Microsoft does not stop there! Each snapshot of the backups in Azure Blob storage gets replicated again to another region for disaster recovery.
All these operations do not cost you any extra charge or RU. Also backups do not affect the performance of your databases. If you need to restore data for any reason, you need to contact Azure support within 8 hours!
There are two ways to manage your own backups if you like to do so. Both options are not free! You can try to use Azure Data Factory if you need to move data from Azure CosmosDB periodically to a different location. Or you can use Azure CosmosDB Change Feed functionality to figure out what is changed in your database and copy/move updated/new data to a different location. Both options will cost you more RU.This option makes more sense to me since CosmosDB aggregation can be limited and costly. It's much easier to create Change Feed function and move the data to another location to analyze. But don't forget, if you use Change Feed function your requests from Azure CosmosDB will cost you more Request Units since CosmosDB needs to do more work for your requests.
Just heard the below yesterday while on a Cosmos DB related Microsoft support call and then happened to stumble across this page.
ReplyDeleteBackup Interval can be anything >=60 minutes. Default is 4 hours.
Backup retention can be anything <=720 hours. Default is 8 hours.
Backup Copies must be >=25. Combination of above two options must be less than 25.
To change the defaults, open a call with Microsoft Support via the Azure Portal.
Cost of additional backups, Free, as long as within limits above.
Where we can see the cosmos db backup snapshot?
ReplyDelete