我目前正在阅读:https://docs.microsoft.com/en-us/azure/sql-database/sql-database-auto-failover-group,并且我很难理解自动故障转移策略:
在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分钟后,它才会故障转移到我的辅助数据库,从而成为新的主数据库。”
即使在同步数据时,它也无法自动进行故障转移,因为主区域中的高可用性解决方案正在尝试执行相同的操作,并且几乎所有时间主数据库都将在主区域中快速恢复。执行自动跨区域故障转移会对此产生干扰。
和
“存在宽限期的原因是,因为辅助数据库成为新的主数据库,因此主数据库上可能存在不同步的数据,这些数据将被覆盖或丢弃”
并留出时间让数据库在主区域内进行故障转移。
关于Azure SQL故障转移组,宽限期是什么意思?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56612793/