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

cow977發表於2019-08-26

3 、自動故障轉移

3 、Automatic Failover

在主副本變得不可用之後,自動故障轉移將導致合格的輔助副本自動轉換為主角色。當承載主副本的WSFC節點對於承載輔助副本的節點而言為本地節點時,自動故障轉移最適合。這是因為資料同步最適合於計算機之間的低訊息延遲時間情況以及因為客戶端連線可以保持為本地。

An automatic failover causes a qualified secondary replica to   automatically transition to the primary role after the primary replica   becomes unavailable. Automatic failover is best suited when the WSFC node   that hosts the primary replica is local to the node that hosts the secondary   replica. This is because data synchronization works best with low message   latency between computers and because client connections can remain local.

3.1 、自動故障轉移所需條件

3.1 、Conditions Required for an Automatic Failover

僅在以下條件下才發生自動故障轉移:

Automatic failover occurs only under the following conditions:

·        存在自動故障轉移集。此自動故障轉移集由主要副本和次要副本(自動故障轉移目標)構成,主要副本和次要副本都配置為同步提交模式並且設定為自動故障轉移。如果主要副本設定為手動故障轉移,則自動故障切換將無法發生,即使將某一次要副本設定為自動故障轉移。

·        An automatic failover set exists. This set consists of a primary replica   and a secondary replica (the automatic failover target) that are both   configured for synchronous-commit mode and set to AUTOMATIC failover. If the   primary replica is set to MANUAL failover, automatic failover cannot occur,   even if a secondary replica is set to AUTOMATIC failover.

有關詳細資訊,請參閱 。

For more information, see .

·        自動故障轉移目標具有正常執行的同步狀態(這指示故障轉移目標上的每個輔助資料庫都與其相應的主資料庫同步)。

·        The automatic failover target has a healthy synchronization state (this   indicates that every secondary database on the failover target is   synchronized with its corresponding primary database).

提示


AlwaysOn 可用性組監視自動故障轉移集中兩個副本的執行狀況。如果任一副本失敗,則該可用性組的執行狀況狀態將設定為“嚴重”。如果輔助副本失敗,則自動故障轉移將不可行,因為自動故障轉移目標不可用。如果主副本失敗,則可用性組將故障轉移到輔助副本。在之前的主副本進入聯機狀態之前,將不存在任何自動故障轉移目標。在任一情況下,為了在連續出現失敗這種近乎不可能發生的情況下確保可用性,我們建議您將其他輔助副本配置為自動故障轉移目標。

Always On Availability Groups monitors the health of both replicas in an   automatic failover set. If either replica fails, the availability group's   health state is set to CRITICAL. If the secondary replica fails, automatic   failover is not possible because the automatic failover target is   unavailable. If the primary replica fails, the availability group will fail   over to the secondary replica. Until the former primary replica comes online,   no automatic failover target exists. In either case, to ensure availability   in the unlikely case of a sequential failure, we recommend that you configure   a different secondary replica as the automatic failover target.

有關詳細資訊,請參閱 和 。

For more information, see   and .

·        Windows Server 故障轉移群集(WSFC)群集具有仲裁。有關詳細資訊,請參閱 。

·        The Windows Server Failover Clustering(WSFC) cluster has quorum. For   more information, see .

·        主副本已變得不可用,並且由靈活的故障轉移策略定義的故障轉移條件級別已得到滿足。有關故障轉移條件級別的資訊,請參閱 。

·        The primary replica has become unavailable, and the failover-condition   levels defined by your the flexible failover policy have been met. For   information about failover-condition levels, see .

3.2 、自動故障轉移的原理

3.2 、How Automatic Failover Works

自動故障轉移將啟動以下操作序列:

An automatic failover initiates the following sequence of actions:

1. 如果承載當前主副本的伺服器例項仍在執行,則它會將主資料庫的狀態更改為“已斷開連線”並斷開所有客戶端的連線。

1. If the server instance that is hosting the current primary replica is   still running, it changes the state of the primary databases to DISCONNECTED   and disconnects all clients.

2. 如果在目標輔助副本上有任何日誌記錄正在恢復佇列中處於等待狀態,則輔助副本會應用剩下的日誌記錄,以完成對輔助資料庫的前滾操作。

2.If any log records are waiting in recovery queues on the target   secondary replica, the secondary replica applies the remaining log records to   finish rolling forward the secondary databases.

備註

Remarks

將日誌應用於給定資料庫所需的時間取決於系統的速度、最近的工作負載以及恢復佇列中的日誌量。

The amount of time required to apply the log to a given database depends   on the speed of the system, the recent work load, and the amount of log in   the recovery queue.

3. 先前的輔助副本轉換到主角色。其資料庫成為主資料庫。新的主副本將盡快回滾任何未提交的事務(恢復的撤消階段)。鎖定會分離這些未提交的事務,允許當客戶端使用資料庫時在後臺進行回滾。此過程不會回滾任何已提交的事務。

3.The former secondary replica transitions to the primary role. Its   databases become the primary databases. The new primary replica rolls back   any uncommitted transactions (the undo phase of recovery) as quickly as   possible. Locks isolate these uncommitted transactions, allowing roll back to   occur in the background while clients use the database. This process does not   roll back any committed transactions.

直到連線給定的輔助資料庫後,才將其簡要標記為 NOT_SYNCHRONIZED。在回滾恢復開始前,輔助資料庫可以連線到新的主資料庫並快速轉換為同步狀態。最佳事例是通常用於第三個同步提交的副本,該副本在故障轉移之後仍然為輔助角色。

Until a given secondary database is connected, it is briefly marked as   NOT_SYNCHRONIZED. Before the rollback recovery starts, secondary databases   can connect to the new primary databases and quickly transition to the   SYNCHRONIZED state. The best case is usually for a third synchronous-commit   replica that remains in the secondary role after the failover.

4. 然後,當承載先前主副本的伺服器例項重新啟動時,它將識別出其他可用性副本現在擁有主角色。以前的主副本將轉換為輔助角色,並且其資料庫將成為輔助資料庫。新的輔助副本連線到當前主副本,並儘快將其資料庫更新為當前主資料庫。只要新的輔助副本重新同步了其資料庫,就可以再次執行故障轉移,但按反向執行。

4. Later, when the server instance that is hosting the former primary   replica restarts, it recognizes that another availability replica now owns   the primary role. The former primary replica transitions to the secondary   role, and its databases become secondary databases. The new secondary replica   connects to the current primary replica and catches its database up to the   current primary databases as quickly as possible. As soon as the new   secondary replica has resynchronized its databases, failover is again   possible, in the reverse direction.

3.3 、配置自動故障轉移

3.3 、To Configure Automatic Failover

可用性副本可以配置為支援在任何一點進行自動故障轉移。

An availability replica can be configured to support automatic failover   at any point.

1. 確保輔助副本配置為使用同步提交可用性模式。有關詳細資訊,請參閱 。

1.Ensure that the secondary replica is configured to use the   synchronous-commit availability mode. For more information, see .

2. 將故障轉移模式設定為自動。有關詳細資訊,請參閱 。

2.Set the failover mode to automatic. For more information, see .

3. 更改可用性組的靈活故障轉移策略,以指定可以導致自動故障轉移的故障類別,此功能為可選的。有關詳細資訊,請參閱 和 。

3.Optionally, change the flexible failover policy of the availability   group to specify the sorts of failures that can cause an automatic failover   to occur. For more information, see and .


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

相關文章