Transforming businesses with cloud technology.

Where we are

Melbourne - 534 Church St, Richmond VIC 3121
Sydney
Brisbane
Adelaide
Perth

Aug 18, 2021

Azure Cosmos DB: Continuous backup with point in time restore now in general availability

Azure Cosmos DB:

Continuous backup with point in time restore now in general availability

 

The Azure Cosmos DB continuous backup with point in time restore helps you recover from accidental deletion of your account or container, in addition to accidental data modification or deletion. Continuous backup mode for the Core (SQL) API and Azure Cosmos DB API for MongoDB allows you to perform a granular restore via the Azure portal, Azure CLI, Azure Resource Manager, and PowerShell to any point in time in the past 30 days. You can use the rich event feed on resources like account and container to handle unknown times of delete of those assets and narrow down the time window in complex scenarios. This feature also offers you the capability to migrate from periodic to continuous mode.

Azure Cosmos DB's point-in-time restore feature helps in multiple scenarios such as the following:

Azure Cosmos DB performs data backup in the background without consuming any extra provisioned throughput (RUs) or affecting the performance and availability of your database. Continuous backups are taken in every region where the account exists. The following image shows how a container with write region in West US, read regions in East and East US 2 is backed up to a remote Azure Blob Storage account in the respective regions. By default, each region stores the backup in Locally Redundant storage accounts. If the region has Availability zones enabled then the backup is stored in Zone-Redundant storage accounts.

 

The available time window for restore (also known as retention period) is the lower value of the following two: 30 days back in past from now or up to the resource creation time. The point in time for restore can be any timestamp within the retention period.

Currently, you can restore the Azure Cosmos DB account for SQL API or MongoDB contents point in time to another account using Azure portal, Azure Command Line Interface (az CLI), Azure PowerShell, or the Azure Resource Manager.

Backup storage redundancy

By default, Azure Cosmos DB stores continuous mode backup data in locally redundant storage blobs. For the regions that have zone redundancy configured, the backup is stored in zone-redundant storage blobs. In continuous backup mode, you can't update the backup storage redundancy.

What is restored?

In a steady-state, all mutations performed on the source account (which includes databases, containers, and items) are backed up asynchronously within 100 seconds. If the backup media (that is Azure storage) is down or unavailable, the mutations are persisted locally until the media is available back and then they are flushed out to prevent any loss in fidelity of operations that can be restored.

You can choose to restore any combination of provisioned throughput containers, shared throughput database, or the entire account. The restore action restores all data and its index properties into a new account. The restore process ensures that all the data restored in an account, database, or container is guaranteed to be consistent up to the restore time specified. The duration of restore will depend on the amount of data that needs to be restored.

Note

With the continuous backup mode, the backups are taken in every region where your Azure Cosmos DB account is available. Backups taken for each region account are Locally redundant by default and Zone redundant if your account has availability zone feature enabled for that region. The restore action always restores data into a new account.

What is not restored?

The following configurations aren't restored after the point-in-time recovery:

You can add these configurations to the restored account after the restore is completed.

Restore scenarios

The following are some of the key scenarios that are addressed by the point-in-time-restore feature. Scenarios [a] through [c] demonstrate how to trigger a restore if the restore timestamp is known beforehand. However, there could be scenarios where you don't know the exact time of accidental deletion or corruption. Scenarios [d] and [e] demonstrate how to discover the restore timestamp using the new event feed APIs on the restorable database or containers.

 

  1. Restore deleted account - All the deleted accounts that you can restore are visible from the Restore pane. For example, if Account A is deleted at timestamp T3. In this case the timestamp just before T3, location, target account name, resource group, and target account name is sufficient to restore from Azure portal, PowerShell, or CLI.

  1. Restore data of an account in a particular region - For example, if Account A exists in two regions East US and West US at timestamp T3. If you need a copy of account A in West US, you can do a point in time restore from Azure portal, PowerShell, or CLI with West US as the target location.

  2. Recover from an accidental write or delete operation within a container with a known restore timestamp - For example, if you know that the contents of Container 1 within Database 1 were modified accidentally at timestamp T3. You can do a point in time restore from Azure portal, PowerShell, or CLI into another account at timestamp T3 to recover the desired state of the container.

  3. Restore an account to a previous point in time before the accidental delete of the database - In the Azure portal, you can use the event feed pane to determine when a database was deleted and find the restore time. Similarly, with Azure CLI and PowerShell, you can discover the database deletion event by enumerating the database events feed and then trigger the restore command with the required parameters.

  4. Restore an account to a previous point in time before the accidental delete or modification of the container properties. - In Azure portal, you can use the event feed pane to determine when a container was created, modified, or deleted to find the restore time. Similarly, with Azure CLI and PowerShell, you can discover all the container events by enumerating the container events feed and then trigger the restore command with the required parameters.

Permissions

Azure Cosmos DB allows you to isolate and restrict the restore permissions for a continuous backup account to a specific role or a principal. The owner of the account can trigger a restore and assign a role to other principals to perform the restore operation. To learn more, see the Permissions article.

Pricing

Azure Cosmos DB accounts that have continuous backup enabled will incur an additional monthly charge to store the backup and to restore your data. The restore cost is added every time the restore operation is initiated. If you configure an account with continuous backup but don't restore the data, only backup storage cost is included in your bill.

The following example is based on the price for an Azure Cosmos account deployed in a non-government region in the US. The pricing and calculation can vary depending on the region you are using, see the Azure Cosmos DB pricing page for the latest pricing information.

For example, if you have 1-TB of data in two regions then:

Current limitations

Currently, the point in time restore functionality has the following limitations:


More Info Ref
Online backup and on-demand data restore in Azure Cosmos DB. | Microsoft Docs