[AlwaysOn] AlwaysOn可用性組的故障轉移和故障轉移模式[中英文對照] 5

cow977發表於2019-08-27

4 、計劃的手動故障轉移(無資料丟失)

4 、Planned Manual Failover (Without Data Loss)

在資料庫管理員針對承載目標輔助副本的伺服器例項發出手動故障轉移命令後,手動故障轉移將導致已同步的輔助副本轉換為主角色。為了支援手動故障轉移,輔助副本和當前主副本必須同時配置為同步提交模式(如果有)。可用性副本上的每個輔助資料庫都必須加入到可用性組中,並與其對應的主資料庫同步(也即,必須同步輔助副本)。這可確保對先前主資料庫提交的每個事務也對新的主資料庫提交。因此,新的主資料庫與舊的主資料庫完全相同。

A manual failover causes a synchronized secondary replica to transition   to the primary role after a database administrator issues a manual-failover   command on the server instance that hosts the target secondary replica. To   support manual failover, the secondary replica and the current primary   replica must both be configured for synchronous-commit mode, if any. Every   secondary database on the availability replica must be joined to the   availability group and synchronized with its corresponding primary database   (that is, the secondary replica must be synchronized). This guarantees that   every transaction that was committed on a former primary database has also   been committed on the new primary database. Therefore, the new primary   databases are identical to the old primary databases.

下圖說明計劃的故障轉移的各個階段:

The following figure illustrates the stages of a planned failover:

1. 在故障轉移之前,主副本位於 Node01 的伺服器例項上。

1. Before the failover, the primary replica is hosted by the server   instance on Node01 .

2. 資料庫管理員啟動計劃的故障轉移。故障轉移目標為位於 Node02 的伺服器例項上的可用性副本。

2.A database administrator initiates a planned failover. The failover   target is the availability replica hosted by the server instance on Node02 .

3. 故障轉移目標(位於 Node02 上)將成為新的主副本。因為這是計劃的故障轉移,以前的主副本在故障轉移期間切換為輔助角色,並且使其資料庫立即聯機作為輔助資料庫。

3. The failover target (on Node02 ) becomes the new primary replica. Because this is a planned failover,   the former primary replica switches to the secondary role during the failover   and brings its databases online as secondary databases immediately.

4.1 、手動故障轉移所需條件

4.1 、Conditions Required for a Manual Failover

為了支援手動故障轉移,當前主副本必須設定為同步提交模式,而輔助副本必須:

To support a manual failover, the current primary replica must be set to   synchronous-commit mode and a secondary replica must be:

·        配置為同步提交模式。

·        Configured for synchronous-commit mode.

·        當前已與主副本同步。

·        Currently synchronized with the primary replica.

若要手動對可用性組執行故障轉移,您必須連線到將成為新的主副本的輔助副本。

To manually fail over an availability group, you must be connected to   the secondary replica that is to become the new primary replica.

4.2 、計劃的手動故障轉移的工作方式

4.2 、How a Planned Manual Failover Works

計劃的手動故障轉移(必須在目標輔助副本上啟動)將啟動以下操作序列:

A planned manual failover, which must be initiated on the target   secondary replica, initiates the following sequence of actions:

1. 為了確保在原始主資料庫上不發生任何新的使用者事務,WSFC群集向主副本傳送要求離線的請求。

1.To ensure that no new user transactions occur on the original primary   databases, the WSFC cluster sends a request to the primary replica to go   offline.

2. 如果任何輔助資料庫的恢復佇列中有任何日誌處於等待狀態,則輔助副本將完成對輔助資料庫進行前滾的操作。所需時間取決於系統速度、最新工作負荷以及恢復佇列中的日誌量。若要了解恢復佇列的當前大小,請使用 Recovery Queue效能計數器。有關詳細資訊,請參閱 SQL Server ,資料庫副本

2. If any log is waiting in the recovery queue of any secondary   database, the secondary replica finishes rolling forward that secondary   database. The amount of time required depends on the speed of the system, the   recent workload, and the amount of log in the recovery queue. To learn the   current size of the recovery queue, use the Recovery Queue performance   counter. For more information, see SQL Server,   Database Replica.

備註

Remarks

可通過限制恢復佇列的大小調整故障轉移時間。不過,這會導致主副本的速度下降,以允許輔助副本與其同步。

The failover time can be regulated by limiting the size of the recovery   queue. However, this can cause the primary replica to slow down to allow the   secondary replica to keep up.

3. 輔助副本成為新的主副本,先前的主副本成為新的輔助副本。

3.The secondary replica becomes the new primary replica, and the former   primary replica becomes the new secondary replica.

4. 新的主要副本會回滾任何未提交的事務,並使其資料庫作為主資料庫上線。所有輔助資料庫都簡要標記為“不同步”,直到它們連線並重新同步到新的主資料庫。此過程不會回滾任何已提交的事務。

4.The new primary replica rolls back any uncommitted transactions and   brings its databases online as the primary databases.All secondary databases   are briefly marked as NOT SYNCHRONIZED until they connect and resynchronize   to the new primary databases. This process does not roll back any committed   transactions.

5. 當以前的主副本重新聯機後,它將承擔輔助角色,而以前的主資料庫將成為輔助資料庫。新的輔助副本快速將新的輔助資料庫與對應的主資料庫重新同步。

5.When the former primary replica comes back online, it takes on the   secondary role, and the former primary database becomes the secondary   database. The new secondary replica quickly resynchronizes the new secondary   databases with the corresponding primary databases.

備註

Remarks

只要新的輔助副本重新同步了資料庫,就可以再次執行故障轉移,但按反向執行。

As soon as the new secondary replica has resynchronized the databases,   failover is again possible, but in the reverse direction.

執行故障轉移後,客戶端必須重新連線到當前的主資料庫。有關詳細資訊,請參閱 可用性組偵聽程式、客戶端連線和應用程式故障轉移(SQL Server)概念。

After failover, clients must reconnect to the current primary database.   For more information, see Availability   Group Listeners, Client Connectivity, and Application Failover (SQL Server).

4.3 、升級期間維護可用性

4.3 、Maintaining Availability During Upgrades

當您升級硬體或軟體時,可用性組的資料庫管理員可以使用手動故障轉移來維護資料庫可用性。若要將可用性組用於軟體升級,承載目標輔助副本的伺服器例項和/或計算機節點必須已經收到升級。有關詳細資訊,請參閱 升級AlwaysOn 可用性組副本例項

The database administrator for your availability groups can use manual   failovers to maintain database availability when you upgrade hardware or   software. To use an availability group for software upgrades, the server   instance and/or computer node that hosts the target secondary replica must   have already received the upgrades. For more information, see Upgrading Always   On Availability Group Replica Instances.


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/81227/viewspace-2655026/,如需轉載,請註明出處,否則將追究法律責任。

相關文章