設定 Azure SQL Database 的容錯移轉群組Configure a failover group for Azure SQL Database

適用於: Azure SQL Database Azure SQL 受控執行個體

本主題將指導您如何設定 Azure SQL Database 和 Azure SQL 受控執行個體的 自動容錯移轉群組This topic teaches you how to configure an auto-failover group for Azure SQL Database and Azure SQL Managed Instance.

單一資料庫Single database

使用 Azure 入口網站或 PowerShell 建立容錯移轉群組,並在其中新增單一資料庫。Create the failover group and add a single database to it using the Azure portal or PowerShell.

必要條件Prerequisites

請考慮下列必要條件:Consider the following prerequisites:

  • 次要伺服器的伺服器登入和防火牆設定必須符合主伺服器的設定。The server login and firewall settings for the secondary server must match that of your primary server.

建立容錯移轉群組Create failover group

使用 Azure 入口網站建立您的容錯移轉群組,並將您的單一資料庫新增至其中。Create your failover group and add your single database to it using the Azure portal.

  1. Azure 入口網站的左側功能表中,選取 [Azure SQL]。Select Azure SQL in the left-hand menu of the Azure portal. 如果 Azure SQL 不在清單中,請選取 [所有服務],然後在搜尋方塊中鍵入 Azure SQL。If Azure SQL is not in the list, select All services, then type Azure SQL in the search box. (選用) 選取 Azure SQL 旁的星號將其設為最愛,並新增為左側導覽中的項目。(Optional) Select the star next to Azure SQL to favorite it and add it as an item in the left-hand navigation.

  2. 選取您要新增至容錯移轉群組的資料庫。Select the database you want to add to the failover group.

  3. 在 [伺服器名稱] 底下選取伺服器的名稱,以開啟伺服器的設定。Select the name of the server under Server name to open the settings for the server.

    開啟單一資料庫的伺服器

  4. 選取 [設定] 窗格底下的 [容錯移轉群組],然後選取 [新增群組],以建立新的容錯移轉群組。Select Failover groups under the Settings pane, and then select Add group to create a new failover group.

    新增容錯移轉群組

  5. 在 [ 容錯移轉群組 ] 頁面上,輸入或選取所需的值,然後選取 [ 建立]。On the Failover Group page, enter or select the required values, and then select Create.

    • 群組內的資料庫:選擇您要新增至容錯移轉群組的資料庫。Databases within the group: Choose the database you want to add to your failover group. 將資料庫新增到容錯移轉群組後,將會自動啟動異地複寫程序。Adding the database to the failover group will automatically start the geo-replication process.

    將 SQL 資料庫新增至容錯移轉群組

測試容錯移轉Test failover

使用 Azure 入口網站或 PowerShell 測試容錯移轉群組的容錯移轉。Test failover of your failover group using the Azure portal or PowerShell.

使用 Azure 入口網站測試容錯移轉群組的容錯移轉。Test failover of your failover group using the Azure portal.

  1. Azure 入口網站的左側功能表中,選取 [Azure SQL]。Select Azure SQL in the left-hand menu of the Azure portal. 如果 Azure SQL 不在清單中,請選取 [所有服務],然後在搜尋方塊中鍵入 "Azure SQL"。If Azure SQL is not in the list, select All services, then type "Azure SQL" in the search box. (選用) 選取 Azure SQL 旁的星號將其設為最愛,並新增為左側導覽中的項目。(Optional) Select the star next to Azure SQL to favorite it and add it as an item in the left-hand navigation.

  2. 選取您要新增至容錯移轉群組的資料庫。Select the database you want to add to the failover group.

    開啟單一資料庫的伺服器

  3. 選取 [設定] 窗格底下的 [容錯移轉群組],然後選擇您剛才建立的容錯移轉群組。Select Failover groups under the Settings pane and then choose the failover group you just created.

    從入口網站選取容錯移轉群組

  4. 檢查哪個伺服器是主要的,哪個伺服器是次要的。Review which server is primary and which server is secondary.

  5. 從工作窗格中選取 [ 容錯移轉 ],以容錯移轉包含您資料庫的容錯移轉群組。Select Failover from the task pane to fail over your failover group containing your database.

  6. 在通知您 TDS 工作階段將中斷的警告上,選取 [是]。Select Yes on the warning that notifies you that TDS sessions will be disconnected.

    容錯移轉包含您資料庫的容錯移轉群組

  7. 檢查哪個伺服器現在是主要的,哪個伺服器是次要的。Review which server is now primary and which server is secondary. 如果容錯移轉成功,這兩部伺服器應該已交換角色。If failover succeeded, the two servers should have swapped roles.

  8. 再次選取 [容錯移轉],讓伺服器容錯回復到其原始角色。Select Failover again to fail the servers back to their original roles.

重要

如果您需要刪除次要資料庫,請先將它從容錯移轉群組中移除,再加以刪除。If you need to delete the secondary database, remove it from the failover group before deleting it. 將次要資料庫從容錯移轉群組中移除之前先將其刪除,可能會導致無法預期的行為。Deleting a secondary database before it is removed from the failover group can cause unpredictable behavior.

彈性集區Elastic pool

建立容錯移轉群組,並使用 Azure 入口網站或 PowerShell 將彈性集區新增至該群組。Create the failover group and add an elastic pool to it using the Azure portal, or PowerShell.

必要條件Prerequisites

請考慮下列必要條件:Consider the following prerequisites:

  • 次要伺服器的伺服器登入和防火牆設定必須符合主伺服器的設定。The server login and firewall settings for the secondary server must match that of your primary server.

建立容錯移轉群組Create the failover group

使用 Azure 入口網站或 PowerShell 建立彈性集區的容錯移轉群組。Create the failover group for your elastic pool using the Azure portal or PowerShell.

使用 Azure 入口網站建立您的容錯移轉群組,並將您的彈性集區新增至該群組。Create your failover group and add your elastic pool to it using the Azure portal.

  1. Azure 入口網站的左側功能表中,選取 [Azure SQL]。Select Azure SQL in the left-hand menu of the Azure portal. 如果 Azure SQL 不在清單中,請選取 [所有服務],然後在搜尋方塊中鍵入 "Azure SQL"。If Azure SQL is not in the list, select All services, then type "Azure SQL" in the search box. (選用) 選取 Azure SQL 旁的星號將其設為最愛,並新增為左側導覽中的項目。(Optional) Select the star next to Azure SQL to favorite it and add it as an item in the left-hand navigation.

  2. 選取您要新增至容錯移轉群組的彈性集區。Select the elastic pool you want to add to the failover group.

  3. 在 [概觀] 窗格中選取 [伺服器名稱] 下的伺服器名稱,以開啟伺服器的設定。On the Overview pane, select the name of the server under Server name to open the settings for the server.

    開啟彈性集區的伺服器

  4. 選取 [設定] 窗格底下的 [容錯移轉群組],然後選取 [新增群組],以建立新的容錯移轉群組。Select Failover groups under the Settings pane, and then select Add group to create a new failover group.

    新增容錯移轉群組

  5. 在 [ 容錯移轉群組 ] 頁面上,輸入或選取所需的值,然後選取 [ 建立]。On the Failover Group page, enter or select the required values, and then select Create. 請建立新的次要伺服器,或選取現有的次要伺服器。Either create a new secondary server, or select an existing secondary server.

  6. 選取 群組中 的 [資料庫],然後選擇您要新增至容錯移轉群組的彈性集區。Select Databases within the group then choose the elastic pool you want to add to the failover group. 如果次要伺服器上還沒有彈性集區,則會出現警告,提示您在次要伺服器上建立彈性集區。If an elastic pool does not already exist on the secondary server, a warning appears prompting you to create an elastic pool on the secondary server. 選取警告,然後選取 [確定],以在次要伺服器上建立彈性集區。Select the warning, and then select OK to create the elastic pool on the secondary server.

    將彈性集區新增至容錯移轉群組

  7. 選取 [選取],將您的彈性集區設定套用至容錯移轉群組,然後選取 [建立] 以建立容錯移轉群組。Select Select to apply your elastic pool settings to the failover group, and then select Create to create your failover group. 將彈性集區新增至容錯移轉群組,將會自動啟動異地複寫程序。Adding the elastic pool to the failover group will automatically start the geo-replication process.

測試容錯移轉Test failover

使用 Azure 入口網站或 PowerShell 測試彈性集區的容錯移轉。Test failover of your elastic pool using the Azure portal or PowerShell.

將容錯移轉群組容錯移轉到次要伺服器,然後使用 Azure 入口網站進行容錯回復。Fail your failover group over to the secondary server, and then fail back using the Azure portal.

  1. Azure 入口網站的左側功能表中,選取 [Azure SQL]。Select Azure SQL in the left-hand menu of the Azure portal. 如果 Azure SQL 不在清單中,請選取 [所有服務],然後在搜尋方塊中鍵入 "Azure SQL"。If Azure SQL is not in the list, select All services, then type "Azure SQL" in the search box. (選用) 選取 Azure SQL 旁的星號將其設為最愛,並新增為左側導覽中的項目。(Optional) Select the star next to Azure SQL to favorite it and add it as an item in the left-hand navigation.

  2. 選取您要新增至容錯移轉群組的彈性集區。Select the elastic pool you want to add to the failover group.

  3. 在 [概觀] 窗格中選取 [伺服器名稱] 下的伺服器名稱,以開啟伺服器的設定。On the Overview pane, select the name of the server under Server name to open the settings for the server.

    開啟彈性集區的伺服器

  4. 選取 [設定] 窗格下的 [容錯移轉群組],然後選擇您在第 2 節中建立的容錯移轉群組。Select Failover groups under the Settings pane and then choose the failover group you created in section 2.

    從入口網站選取容錯移轉群組

  5. 檢查哪個伺服器是主要的,哪個伺服器是次要的。Review which server is primary, and which server is secondary.

  6. 從工作窗格中選取 [容錯移轉],以容錯移轉包含彈性集區的容錯移轉群組。Select Failover from the task pane to fail over your failover group containing your elastic pool.

  7. 在通知您 TDS 工作階段將中斷的警告上,選取 [是]。Select Yes on the warning that notifies you that TDS sessions will be disconnected.

    容錯移轉包含您資料庫的容錯移轉群組

  8. 檢查哪個伺服器是主要的,哪個伺服器是次要的。Review which server is primary, which server is secondary. 如果容錯移轉成功,這兩部伺服器應該已交換角色。If failover succeeded, the two servers should have swapped roles.

  9. 再次選取 [容錯移轉],將容錯移轉群組容錯回復至原始設定。Select Failover again to fail the failover group back to the original settings.

重要

如果您需要刪除次要資料庫,請先將它從容錯移轉群組中移除,再加以刪除。If you need to delete the secondary database, remove it from the failover group before deleting it. 將次要資料庫從容錯移轉群組中移除之前先將其刪除,可能會導致無法預期的行為。Deleting a secondary database before it is removed from the failover group can cause unpredictable behavior.

SQL 受控執行個體SQL Managed Instance

使用 Azure 入口網站或 PowerShell,在 Azure SQL 受控執行個體的兩個受控實例之間建立容錯移轉群組。Create a failover group between two managed instances in Azure SQL Managed Instance by using the Azure portal or PowerShell.

您必須為每個 SQL 受控執行個體的虛擬網路設定 ExpressRoute 或建立閘道、連接兩個閘道,然後建立容錯移轉群組。You will need to either configure ExpressRoute or create a gateway for the virtual network of each SQL Managed Instance, connect the two gateways, and then create the failover group.

基於效能考慮,這兩個受控執行個體都會部署到配對區域Deploy both managed instances to paired regions for performance reasons. 相較於非配對區域,位於異地配對區域中的受控執行個體會有更好的效能。Managed instances residing in geo-paired regions have much better performance compared to unpaired regions.

必要條件Prerequisites

請考慮下列必要條件:Consider the following prerequisites:

  • 次要受控實例必須是空的。The secondary managed instance must be empty.
  • 次要虛擬網路的子網範圍不得與主要虛擬網路的子網範圍重迭。The subnet range for the secondary virtual network must not overlap the subnet range of the primary virtual network.
  • 次要受控實例的定序和時區必須與主要受控實例的定序和時區相符。The collation and timezone of the secondary managed instance must match that of the primary managed instance.
  • 連接這兩個閘道時,這兩個連線的 共用金鑰 應該相同。When connecting the two gateways, the Shared Key should be the same for both connections.

建立主要虛擬網路閘道Create primary virtual network gateway

如果您尚未設定 ExpressRoute,您可以使用 Azure 入口網站或 PowerShell 來建立主要虛擬網路閘道。If you have not configured ExpressRoute, you can create the primary virtual network gateway with the Azure portal, or PowerShell.

注意

閘道的 SKU 會影響輸送量效能。The SKU of the gateway affects throughput performance. 本文會部署具有最基本 SKU () 的閘道 HwGw1This article deploys a gateway with the most basic SKU (HwGw1). 部署較高的 SKU (例如:VpnGw3) 可達到更高的輸送量。Deploy a higher SKU (example: VpnGw3) to achieve higher throughput. 如需所有可用選項,請參閱閘道 SKUFor all available options, see Gateway SKUs

使用 Azure 入口網站建立主要虛擬網路閘道。Create the primary virtual network gateway using the Azure portal.

  1. Azure 入口網站中,移至您的資源群組,然後為您的主要受控執行個體選取 虛擬網路 資源。In the Azure portal, go to your resource group and select the Virtual network resource for your primary managed instance.

  2. 選取 [設定] 底下的 [子網路],然後選取新增 [閘道子網路]。Select Subnets under Settings and then select to add a new Gateway subnet. 請保留預設值。Leave the default values.

    為主要受控執行個體新增閘道

  3. 建立子網路閘道之後,從左側瀏覽窗格中選取 [建立資源],然後在搜尋方塊中輸入 Virtual network gatewayOnce the subnet gateway is created, select Create a resource from the left navigation pane and then type Virtual network gateway in the search box. 選取 Microsoft 發佈的 虛擬網路閘道 資源。Select the Virtual network gateway resource published by Microsoft.

    建立新的虛擬網路閘道

  4. 填寫必要欄位,以設定您的主要受控實例閘道。Fill out the required fields to configure the gateway your primary managed instance.

    下表顯示主要受控執行個體閘道所需的值:The following table shows the values necessary for the gateway for the primary managed instance:

    欄位Field Value
    訂用帳戶Subscription 您主要受控執行個體所在的訂用帳戶。The subscription where your primary managed instance is.
    名稱Name 虛擬網路閘道的名稱。The name for your virtual network gateway.
    區域Region 您主要受控執行個體所在的區域。The region where your primary managed instance is.
    閘道類型Gateway type 選取 [VPN]。Select VPN.
    VPN 類型VPN Type 選取以 路由為基礎的Select Route-based
    SKUSKU 保留預設值:VpnGw1Leave default of VpnGw1.
    位置Location 次要受控實例和次要虛擬網路所在的位置。The location where your secondary managed instance and secondary virtual network is.
    虛擬網路Virtual network 選取次要受控實例的虛擬網路。Select the virtual network for your secondary managed instance.
    公用 IP 位址Public IP address 選取 [建立新的]。Select Create new.
    公用 IP 位址名稱Public IP address name 輸入您的 IP 位址名稱。Enter a name for your IP address.
       
  5. 將其他值保留為預設值,然後選取 [檢閱 + 建立] 來檢閱虛擬網路閘道的設定。Leave the other values as default, and then select Review + create to review the settings for your virtual network gateway.

    主要閘道設定

  6. 選取 [建立] 以建立新的虛擬網路閘道。Select Create to create your new virtual network gateway.

建立次要虛擬網路閘道Create secondary virtual network gateway

使用 Azure 入口網站或 PowerShell 建立次要虛擬網路閘道。Create the secondary virtual network gateway using the Azure portal or PowerShell.

重複上一節中的步驟,以建立次要受控實例的虛擬網路子網和閘道。Repeat the steps in the previous section to create the virtual network subnet and gateway for the secondary managed instance. 填寫必要欄位,為您的次要受控執行個體設定閘道。Fill out the required fields to configure the gateway for your secondary managed instance.

下表顯示次要受控執行個體閘道所需的值:The following table shows the values necessary for the gateway for the secondary managed instance:

欄位Field Value
訂用帳戶Subscription 次要受控執行個體所在的訂用帳戶。The subscription where your secondary managed instance is.
名稱Name 虛擬網路閘道的名稱,例如 secondary-mi-gatewayThe name for your virtual network gateway, such as secondary-mi-gateway.
區域Region 次要受控執行個體所在的區域。The region where your secondary managed instance is.
閘道類型Gateway type 選取 [VPN]。Select VPN.
VPN 類型VPN Type 選取以 路由為基礎的Select Route-based
SKUSKU 保留預設值:VpnGw1Leave default of VpnGw1.
位置Location 次要受控實例和次要虛擬網路所在的位置。The location where your secondary managed instance and secondary virtual network is.
虛擬網路Virtual network 選取在第 2 節中建立的虛擬網路,例如 vnet-sql-mi-secondarySelect the virtual network that was created in section 2, such as vnet-sql-mi-secondary.
公用 IP 位址Public IP address 選取 [建立新的]。Select Create new.
公用 IP 位址名稱Public IP address name 輸入 IP 位址的名稱,例如 secondary-gateway-IPEnter a name for your IP address, such as secondary-gateway-IP.
   

次要閘道設定

連結閘道Connect the gateways

使用 Azure 入口網站或 PowerShell 建立兩個閘道之間的連接。Create connections between the two gateways using the Azure portal or PowerShell.

必須建立兩個連線:從主要閘道到次要閘道的連線,然後從次要閘道到主要閘道的連線。Two connections need to be created - the connection from the primary gateway to the secondary gateway, and then the connection from the secondary gateway to the primary gateway.

針對每個連線,這兩個連接所使用的共用金鑰都應該相同。The shared key used for both connections should be the same for each connection.

使用 Azure 入口網站建立兩個閘道之間的連接。Create connections between the two gateways using the Azure portal.

  1. Azure 入口網站選取 [建立資源]。Select Create a resource from the Azure portal.

  2. 在搜尋方塊中輸入 connection,然後按 Enter 鍵進行搜尋,這會帶您前往 Microsoft 發佈的 連線 資源。Type connection in the search box and then press enter to search, which takes you to the Connection resource, published by Microsoft.

  3. 選取 [建立] 以建立您的連線。Select Create to create your connection.

  4. 在 [ 基本 ] 索引標籤上,選取下列值,然後選取 [確定]On the Basics tab, select the following values and then select OK.

    1. 選取 VNet-to-VNet 作為 [連線類型]。Select VNet-to-VNet for the Connection type.
    2. 從下拉式清單中選取訂用帳戶。Select your subscription from the drop-down.
    3. 在下拉式清單中,選取您受控實例的資源群組。Select the resource group for your managed instance in the drop-down.
    4. 從下拉式清單中選取您的主要受控執行個體位置。Select the location of your primary managed instance from the drop-down.
  5. 在 [ 設定 ] 索引標籤上,選取或輸入下列值,然後選取 [確定]On the Settings tab, select or enter the following values and then select OK:

    1. 選擇主要網路閘道作為 [第一個虛擬網路閘道],例如 Primary-GatewayChoose the primary network gateway for the First virtual network gateway, such as Primary-Gateway.
    2. 選擇次要網路閘道作為 [第二個虛擬網路閘道],例如 Secondary-GatewayChoose the secondary network gateway for the Second virtual network gateway, such as Secondary-Gateway.
    3. 選取 [建立雙向連線] 旁的核取方塊。Select the checkbox next to Establish bidirectional connectivity.
    4. 保留預設的主要連線名稱,或將其重新命名為您選擇的值。Either leave the default primary connection name, or rename it to a value of your choice.
    5. 提供連線的 共用金鑰 (PSK) ,例如 mi1m2pskProvide a Shared key (PSK) for the connection, such as mi1m2psk.

    建立閘道連線

  6. 在 [ 摘要 ] 索引標籤上,檢查雙向連接的設定,然後選取 [確定] 以建立您的連接。On the Summary tab, review the settings for your bidirectional connection and then select OK to create your connection.

建立容錯移轉群組Create the failover group

使用 Azure 入口網站或 PowerShell 來建立受控實例的容錯移轉群組。Create the failover group for your managed instances by using the Azure portal or PowerShell.

使用 Azure 入口網站建立 SQL 受控實例的容錯移轉群組。Create the failover group for your SQL Managed Instances by using the Azure portal.

  1. Azure 入口網站的左側功能表中,選取 [Azure SQL]。Select Azure SQL in the left-hand menu of the Azure portal. 如果 Azure SQL 不在清單中,請選取 [所有服務],然後在搜尋方塊中鍵入 Azure SQL。If Azure SQL is not in the list, select All services, then type Azure SQL in the search box. (選用) 選取 Azure SQL 旁的星號將其設為最愛,並新增為左側導覽中的項目。(Optional) Select the star next to Azure SQL to favorite it and add it as an item in the left-hand navigation.

  2. 選取您要新增至容錯移轉群組的主要受管理的實例。Select the primary managed instance you want to add to the failover group.

  3. 在 [ 設定] 底下,流覽至 [ 實例容錯移轉群組 ],然後選擇 [ 加入群組 ] 以開啟 [ 實例容錯移轉群組 ] 頁面。Under Settings, navigate to Instance Failover Groups and then choose to Add group to open the Instance Failover Group page.

    新增容錯移轉群組

  4. 在 [ 實例容錯移轉群組 ] 頁面上,輸入您的容錯移轉群組的名稱,然後從下拉式清單中選擇次要受控實例。On the Instance Failover Group page, type the name of your failover group and then choose the secondary managed instance from the drop-down. 選取 [建立] 來建立您的容錯移轉群組。Select Create to create your failover group.

    建立容錯移轉群組

  5. 完成容錯移轉群組的部署之後,您會回到 [容錯移轉群組] 頁面。Once failover group deployment is complete, you will be taken back to the Failover group page.

測試容錯移轉Test failover

使用 Azure 入口網站或 PowerShell 測試容錯移轉群組的容錯移轉。Test failover of your failover group using the Azure portal or PowerShell.

使用 Azure 入口網站測試容錯移轉群組的容錯移轉。Test failover of your failover group using the Azure portal.

  1. Azure 入口網站中,瀏覽至「次要」受控執行個體,然後選取 [設定] 底下的 [執行個體容錯移轉群組]。Navigate to your secondary managed instance within the Azure portal and select Instance Failover Groups under settings.

  2. 檢閱哪個受控執行個體是主要的,以及哪個受控執行個體是次要的。Review which managed instance is the primary, and which managed instance is the secondary.

  3. 選取 [容錯移轉],然後在 TDS 工作階段將中斷連線的警告上,選取 [是]。Select Failover and then select Yes on the warning about TDS sessions being disconnected.

    容錯移轉到容錯移轉群組

  4. 檢查哪個受控實例是主要複本,以及哪個實例是次要複本。Review which manged instance is the primary and which instance is the secondary. 如果容錯移轉成功,這兩個執行個體應該已交換角色。If failover succeeded, the two instances should have switched roles.

    受控執行個體在容錯移轉後已交換角色

  5. 移至新的「次要」受控執行個體,然後再次選取 [容錯移轉],將主要執行個體容錯回復至主要角色。Go to the new secondary managed instance and select Failover once again to fail the primary instance back to the primary role.

使用 private link 可讓您將邏輯伺服器與虛擬網路和子網內的特定私人 IP 位址產生關聯。Using a private link allows you to associate a logical server to a specific private IP address within the virtual network and subnet.

若要使用私人連結搭配您的容錯移轉群組,請執行下列動作:To use a private link with your failover group, do the following:

  1. 確定您的主要和次要伺服器都在 配對的區域中。Ensure your primary and secondary servers are in a paired region.
  2. 在每個區域中建立虛擬網路和子網,以裝載主要和次要伺服器的私人端點,使其具有非重迭的 IP 位址空間。Create the virtual network and subnet in each region to host private endpoints for primary and secondary servers such that they have non-overlapping IP address spaces. 例如,主要的虛擬網路位址範圍 10.0.0.0/16 和第二個虛擬網路位址範圍 10.0.0.1/16 重迭。For example, the primary virtual network address range of 10.0.0.0/16 and the secondary virtual network address range of 10.0.0.1/16 overlaps. 如需虛擬網路位址範圍的詳細資訊,請參閱 設計 Azure 虛擬網路的 blog。For more information about virtual network address ranges, see the blog designing Azure virtual networks.
  3. 建立 主要伺服器的私人端點和 Azure 私人 DNS 區域Create a private endpoint and Azure Private DNS zone for the primary server.
  4. 也請為次要伺服器建立私人端點,但這次選擇重複使用為主伺服器建立的相同私人 DNS 區域。Create a private endpoint for the secondary server as well, but this time choose to reuse the same Private DNS zone that was created for the primary server.
  5. 建立私人連結之後,您可以遵循本文先前所述的步驟來建立容錯移轉群組。Once the private link is established, you can create the failover group following the steps outlined previously in this article.

尋找接聽程式端點Locate listener endpoint

設定容錯移轉群組之後,請將應用程式的連接字串更新為接聽程式端點。Once your failover group is configured, update the connection string for your application to the listener endpoint. 這會讓您的應用程式連接到容錯移轉群組接聽程式,而不是主資料庫、彈性集區或實例資料庫。This will keep your application connected to the failover group listener, rather than the primary database, elastic pool, or instance database. 如此一來,您就不需要在每次資料庫實體容錯移轉時手動更新連接字串,並將流量路由傳送到目前為主要的任何實體。That way, you don't have to manually update the connection string every time your database entity fails over, and traffic is routed to whichever entity is currently primary.

接聽程式端點的形式為 fog-name.database.windows.net ,而且在查看容錯移轉群組時,會顯示在 Azure 入口網站中:The listener endpoint is in the form of fog-name.database.windows.net, and is visible in the Azure portal, when viewing the failover group:

容錯移轉群組連接字串

備註Remarks

  • 移除單一或集區資料庫的容錯移轉群組並不會停止複寫,也不會刪除複寫的資料庫。Removing a failover group for a single or pooled database does not stop replication, and it does not delete the replicated database. 如果您想要在移除容錯移轉群組之後,將單一或集區資料庫加入至容錯移轉群組,則必須手動停止異地複寫,並從次要伺服器刪除該資料庫。You will need to manually stop geo-replication and delete the database from the secondary server if you want to add a single or pooled database back to a failover group after it's been removed. 如果無法這麼做,可能會導致類似于 The operation cannot be performed due to multiple errors 嘗試將資料庫加入至容錯移轉群組時的錯誤。Failing to do either may result in an error similar to The operation cannot be performed due to multiple errors when attempting to add the database to the failover group.

下一步Next steps

如需設定容錯移轉群組的詳細步驟,請參閱下列教學課程:For detailed steps configuring a failover group, see the following tutorials:

如需 Azure SQL Database 高可用性選項的總覽,請參閱 異地 複寫和 自動容錯移轉群組For an overview of Azure SQL Database high availability options, see geo-replication and auto-failover groups.