中我们比较全面的介绍了 Azure SQL Database Active Geo-Replication 的主要特点和优势。接下来我们将从自动化的角度介绍如何通过 PowerShell 在项目中实现 Active Geo-Replication 的操作。
》中的 “安装 powershell 的 azure module”小节,会简洁一些。
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
。
= Get-AzureRmSqlDatabase –DatabaseName -ResourceGroupName -ServerName
= | New-AzureRmSqlDatabaseSecondary –PartnerResourceGroupName –PartnerServerName -AllowConnections
= Get-AzureRmSqlDatabase –DatabaseName -ResourceGroupName -ServerName
= | Get-AzureRmSqlDatabaseReplicationLink –PartnerResourceGroup –PartnerServerName
| Remove-AzureRmSqlDatabaseSecondary
= Get-AzureRmSqlDatabase –DatabaseName –ResourceGroupName –ServerName sqltest