我正在阅读以下内容:https://learn.microsoft.com/en-us/azure/sql-database/sql-database-auto-failover-group,但是我对自动故障转移政策很难理解:
默认情况下,故障转移组配置了自动故障转移策略。SQL 数据库服务在检测到故障并且优雅期过期后,会触发故障转移。系统必须验证 SQL 数据库服务内置的高可用性基础架构无法通过规模来缓解停机带来的影响。如果您想从应用程序中控制故障转移工作流程,则可以关闭自动故障转移。
在 ARM 模板中定义故障转移组时:
{
"condition": "[equals(parameters('redundancyId'), 'pri')]",
"type": "Microsoft.Sql/servers",
"kind": "v12.0",
"name": "[variables('sqlServerPrimaryName')]",
"apiVersion": "2014-04-01-preview",
"location": "[parameters('location')]",
"properties": {
"administratorLogin": "[parameters('sqlServerPrimaryAdminUsername')]",
"administratorLoginPassword": "[parameters('sqlServerPrimaryAdminPassword')]",
"version": "12.0"
},
"resources": [
{
"condition": "[equals(parameters('redundancyId'), 'pri')]",
"apiVersion": "2015-05-01-preview",
"type": "failoverGroups",
"name": "[variables('sqlFailoverGroupName')]",
"properties": {
"serverName": "[variables('sqlServerPrimaryName')]",
"partnerServers": [
{
"id": "[resourceId('Microsoft.Sql/servers/', variables('sqlServerSecondaryName'))]"
}
],
"readWriteEndpoint": {
"failoverPolicy": "Automatic",
"failoverWithDataLossGracePeriodMinutes": 60
},
"readOnlyEndpoint": {
"failoverPolicy": "Disabled"
},
"databases": [
"[resourceId('Microsoft.Sql/servers/databases', variables('sqlServerPrimaryName'), variables('sqlDatabaseName'))]"
]
},
"dependsOn": [
"[variables('sqlServerPrimaryName')]",
"[resourceId('Microsoft.Sql/servers/databases', variables('sqlServerPrimaryName'), variables('sqlDatabaseName'))]",
"[resourceId('Microsoft.Sql/servers', variables('sqlServerSecondaryName'))]"
]
},
{
"condition": "[equals(parameters('redundancyId'), 'pri')]",
"name": "[variables('sqlDatabaseName')]",
"type": "databases",
"apiVersion": "2014-04-01-preview",
"location": "[parameters('location')]",
"dependsOn": [
"[variables('sqlServerPrimaryName')]"
],
"properties": {
"edition": "[variables('sqlDatabaseEdition')]",
"requestedServiceObjectiveName": "[variables('sqlDatabaseServiceObjective')]"
}
}
]
},
{
"condition": "[equals(parameters('redundancyId'), 'pri')]",
"type": "Microsoft.Sql/servers",
"kind": "v12.0",
"name": "[variables('sqlServerSecondaryName')]",
"apiVersion": "2014-04-01-preview",
"location": "[variables('sqlServerSecondaryRegion')]",
"properties": {
"administratorLogin": "[parameters('sqlServerSecondaryAdminUsername')]",
"administratorLoginPassword": "[parameters('sqlServerSecondaryAdminPassword')]",
"version": "12.0"
}
}
我像这样指定了readWriteEndpoint:
"readWriteEndpoint": {
"failoverPolicy": "Automatic",
"failoverWithDataLossGracePeriodMinutes": 60
}
将 failoverWithDataLossGracePeriodMinutes 设置为 60 分钟。
这是什么意思?我找不到任何清晰的答案。它是否意味着:
- 当我的主要数据库所在的主要区域发生故障时,读写终点指向主要终点,仅在 60 分钟后才故障转移至我的次要终点,成为新的主终点。在 60 分钟内,唯一读取我的数据的方法是直接使用 readOnlyEndpoint 吗?OR
- 如果它们能够检测到没有要同步的数据,那么我的读/写终点会立即关闭。
我认为这归结为:如果我不关心数据丢失,但想能够写入数据库,是否必须手动执行故障转移,如果检测到故障的话?
奖励问题:为什么存在宽限期?因为主服务器上可能有未同步的数据,如果次服务器成为新的主服务器(如果我手动切换),则该数据将被覆盖或丢弃吗?
抱歉,我无法只保留一个问题。我已经阅读了很多,我真的需要知道这个。