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

标签 azure azure-sql-database automatic-failover

我目前正在阅读此内容:https://learn.microsoft.com/en-us/azure/sql-database/sql-database-auto-failover-group ,我很难理解自动故障转移策略:

By default, a failover group is configured with an automatic failover policy. The SQL Database service triggers failover after the failure is detected and the grace period has expired. The system must verify that the outage cannot be mitigated by the built-in high availability infrastructure of the SQL Database service due to the scale of the impact. If you want to control the failover workflow from the application, you can turn off automatic failover.

在 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
    }

将故障转移WithDataLossGracePeriodMinutes 设置为 60 分钟。

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

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

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

额外问题:存在宽限期的原因是主数据库上可能存在未同步的数据,如果辅助数据库成为新的主数据库(如果我手动切换),这些数据将被覆盖或丢弃?

抱歉,我不能只问一个问题。我读了很多书,我真的需要知道这一点。

最佳答案

What does this mean?

这意味着:

“当我的主数据库所在的主要区域发生中断时,读/写端点会指向主数据库,并且仅在 60 分钟后才会故障转移到我的辅助数据库,该辅助数据库将成为新的主数据库。”

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

还有

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

并留出时间让数据库在主要区域内进行故障转移。

关于Azure SQL 故障转移组,宽限期是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56612793/

相关文章:

azure - 如何配置复合 C1 以将 .m 和桌面作为同一站点提供服务

c# - 来自现场设备的 UDP 数据包不会通过 azure 基础设施到达我的服务

java - 如何使用 opensaml 验证 (azure) saml xml 响应?

azure - 在 Azure 中的 Web 角色和辅助角色之间共享代码

c# - 是否可以使用 NETMF 对嵌入式设备进行编程以将 geochron 记录写入 Azure?

postgresql - PgPool-II 和 repmgr 自动故障转移

c# - 使用 Azure 地理冗余 (RA-GRS) 表存储时,如何更新 ASP.NET Core 中的 TableServiceClient 以指向辅助区域?

sql-server - SQL Server 外部表中的计算列

sql-server - 导入数据层应用程序失败