How to Create Azure SQL Server Replica?

Following script can be used to provision the Mongo Database inside Azure CosmosDb with enabled geo replica:

az cosmosdb create --subscription '***' --resource-group $rg --name harmandb --kind MongoDB --capabilities EnableAggregationPipeline --default-consistency-level "Eventual" --backup-policy-type Periodic  --backup-redundancy Geo --locations regionName="northeurope" failoverPriority=0 isZoneRedundant=False --locations regionName="centralus" failoverPriority=1 isZoneRedundant=False

The read and write location (primary) is the north Europe location (failover priority=0). The write location is central us (failover priority=1).

14133_CosmosDb%20geo%20replica

If this is not enough, you can easily add another fail-over location in Japan:

az cosmosdb create --subscription '***' --resource-group $rg --name harmandb --kind MongoDB --capabilities EnableAggregationPipeline --default-consistency-level "Eventual" --backup-policy-type Periodic  --backup-redundancy Geo --locations regionName="northeurope" failoverPriority=0 isZoneRedundant=False --locations regionName="centralus" failoverPriority=1 isZoneRedundant false --locations regionName="japaneast" failoverPriority=2 isZoneRedundant=False =False 

141316_CosmosDb%203%20geo%20replicas

Previous scripts created the database, which is doing the periodical geo-replicated backup.

--backup-policy-type Periodic  --backup-redundancy Geo 

141325_CosmosDb%20BackupRestore

However, the CosmosDb offers also the point-in-time restore backup. If you want to change the backup strategy, you can execute the following script, which will change the backup from periodical one to a continuous one (Point-In-Time-Recovery)

To do this the backup-policy-type should be changed to Continuous.

az cosmosdb create --subscription '***' --resource-group $rg --name harmandb --kind MongoDB --capabilities EnableAggregationPipeline --default-consistency-level "Eventual" --backup-policy-type Continuous  --backup-redundancy Geo --locations regionName="northeurope" failoverPriority=0 isZoneRedundant=False --locations regionName="centralus" failoverPriority=1 isZoneRedundant false --locations regionName="japaneast" failoverPriority=2 isZoneRedundant=False =False 

After the reprovisioning (update of the existing DB) you can see that the blade backup and restore is missing and the new one Point in Time Restore appears.

141353_CosmosDb%20PointInTimeRestore


comments powered by Disqus