Azure SQL故障转移组,宽限期是什么意思?

时间:2019-06-15 17:48:56

标签: azure azure-sql-database automatic-failover

我目前正在阅读以下内容: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分钟。

这是什么意思?我在任何地方都找不到清晰的答案。这是否意味着:

  1. 当我的主数据库所在的主区域发生故障时,读/写端点指向主数据库,仅在60分钟后,故障转移到我的辅助数据库,该辅助数据库成为新的主数据库。在60分钟内,读取我的数据的唯一方法是直接使用readOnlyEndpoint?或
  2. 如果他们能以某种方式检测到没有要同步的数据,我的读/写端点将被立即关闭

我认为可以归结为:如果检测到严重故障,如果我不关心数据丢失,但是我希望能够写入数据库,是否必须手动进行故障转移?

奖金问题:存在宽限期的原因是,因为如果次级服务器成为新的初级服务器,则初级服务器上可能存在不同步的数据,这些数据将被覆盖或丢弃)?

对不起,但我不能只回答一个问题。我读了很多书,我真的需要知道这一点。

1 个答案:

答案 0 :(得分:1)

  

这是什么意思?

这意味着:

“当我的主数据库所在的主区域发生故障时,读/写端点指向主数据库,只有在60分钟后,它才会故障转移到我的辅助数据库,从而成为新的主数据库。”

即使同步数据,它也不会自动进行故障转移,因为主区域中的高可用性解决方案正在尝试执行相同的操作,并且几乎所有时间主数据库都会在主区域中快速恢复。执行自动跨区域故障转移会对此产生干扰。

“宽限期之所以存在,是因为在主数据库上可能存在不同步的数据,如果辅助数据库成为新的主数据库,则该数据将被覆盖或丢弃”

并为数据库腾出时间在主区域内进行故障转移。

相关问题