我目前正在阅读:https ://docs.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 吗?或者
- 如果他们以某种方式可以检测到没有要同步的数据,我的读/写端点会立即打开
我认为它归结为:我是否必须手动进行故障转移,如果我检测到中断,如果我不关心数据丢失,但我希望能够写入我的数据库?
额外的问题:存在宽限期的原因是因为主服务器上可能存在未同步的数据,如果辅助服务器成为新的主服务器(如果我手动切换),这些数据将被覆盖或丢弃?
抱歉,我不能只回答一个问题。我读了很多书,我真的需要知道这一点。