windows無法啟動sql server服務,SQL Server Always On可用性組中的Windows故障轉移群集仲裁模式

 2023-10-18 阅读 24 评论 0

摘要:This article gives an overview of Windows Failover Cluster Quorum modes that is necessary for SQL Server Always on Availability Groups. 本文概述了Windows故障轉移群集仲裁模式,這對于SQL Server始終在可用性組上是必需的。 介紹 (Introduction) SQL Server

This article gives an overview of Windows Failover Cluster Quorum modes that is necessary for SQL Server Always on Availability Groups.

本文概述了Windows故障轉移群集仲裁模式,這對于SQL Server始終在可用性組上是必需的。

介紹 (Introduction)

SQL Server Always On is a flexible design solution to provide high availability (HA) and disaster recovery (DR). It is built upon the Windows Failover Cluster, but we do not require the shared storage between the failover cluster nodes. Each replica maintains its storage, system databases, agent jobs, login, linked servers, credentials and integration service packages. Before SQL Server 2012, we use database mirroring and the log shipping for HADR solutions.

windows無法啟動sql server服務。 SQL Server Always On是一種靈活的設計解決方案,可提供高可用性(HA)和災難恢復(DR)。 它基于Windows故障轉移群集構建,但是我們不需要故障轉移群集節點之間的共享存儲。 每個副本都維護其存儲,系統數據庫,代理作業,登錄名,鏈接服務器,憑據和集成服務包。 在SQL Server 2012之前,我們將數據庫鏡像和日志傳送用于HADR解決方案。

SQL Server Always On replaces the database mirroring and log shipping for the HADR solution. We define availability groups as a single unit of failure to the secondary replica. We also define a SQL listener to redirect all application connections to the primary replica, regardless of which replica is having a primary role.

SQL Server Always On取代了HADR解決方案的數據庫鏡像和日志傳送。 我們將可用性組定義為輔助副本的單個故障單元。 我們還定義了一個SQL偵聽器,以將所有應用程序連接重定向到主副本,而不管哪個副本具有主角色。

The basic requirements for configuring SQL Server Always On is the failover clustering. All the participating nodes should be part of the failover cluster.

sql server group by? 配置SQL Server Always On的基本要求是故障轉移群集。 所有參與的節點都應該是故障轉移群集的一部分。

  • Note: Starting from SQL 2017, we can configure clusterless AG groups as well. You can refer to the article, 注意:從SQL 2017開始,我們也可以配置無集群AG組。 您可以參考無Read Scale Availability Group in a clusterless availability group for more details. This article assumes the SQL Server Always on with failover clustering.集群可用性組中的閱讀擴展可用性組文章以獲得更多詳細信息。 本文假定SQL Server始終具有故障轉移群集功能。

Once you configure a new availability group, it validates the Windows Failover Cluster quorum vote configuration.

配置新的可用性組后,它將驗證Windows故障轉移群集仲裁投票配置。

Windows Failover Cluster validation in the new Availability Group configuration

sql集群和alwayson區別。 In this article, we will discuss the quorum in the Windows cluster and various methods to configure the nodes voting.

在本文中,我們將討論Windows群集中的仲裁以及配置節點投票的各種方法。

Windows故障轉移群集中的仲裁概述 (Overview of Quorum in Windows Failover Cluster)

In the Windows Failover Cluster, we have two or more cluster nodes, and these nodes communicate with each other on the UDP port 3343. Suppose due to some unforeseen circumstances; nodes cannot communicate with each other. In this case, all cluster nodes assume that they need to bring the resources online. Multiple nodes might try to bring the same resource online at the same time, but it is not possible to do so. This situation is called a Split-Brain situation, and we never want to be in this situation. We might face data corruption issues in this case.

在Windows故障轉移群集中,我們有兩個或更多群集節點,這些節點在UDP端口3343上相互通信。 節點無法相互通信。 在這種情況下,所有群集節點都假定它們需要使資源聯機。 多個節點可能會嘗試同時使同一資源聯機,但是不可能這樣做。 這種情況稱為“腦裂”情況,我們永遠都不想陷入這種情況。 在這種情況下,我們可能會遇到數據損壞問題。

We can avoid a split-brain scenario in Windows Failover Cluster by bringing the resources on a single node. Windows cluster achieve this by implementing a voting mechanism. Quorum checks for the minimum number of votes required to have a majority and own the resources.

通過將資源放在單個節點上,我們可以避免Windows故障轉移群集中出現裂腦的情況。 Windows群集通過實現表決機制來實現此目的。 法定人數檢查是否擁有多數票并擁有資源所需的最低票數。

Each cluster node is allowed to cast its single vote. In each scenario, more than half of the voters must be online, and they should be able to communicate with each other. If the cluster does not achieve the majority, it fails to start the cluster services and the entire cluster is down.

每個群集節點都可以投票。 在每種情況下,一半以上的選民必須在線,并且他們應該能夠相互交流。 如果群集未達到多數,則它將無法啟動群集服務,并且整個群集都將關閉。

The high-level steps in a cluster nodes communication are as follows.

群集節點通信中的高級步驟如下。

  • The cluster node in the Windows Failover Cluster tries to begin a communication with all other nodes in the cluster group

    Windows故障轉移群集中的群集節點嘗試開始與群集組中的所有其他節點進行通信
  • Once communication is set up between the available nodes, they talk to each other to achieve a majority

    一旦在可用節點之間建立了通信,它們就會互相交談以取得多數
  • If after voting, a majority is established, the cluster resources become online

    如果經過表決獲得多數票,則群集資源將聯機
  • In the case of no majority, cluster services are set to offline status for a temporary basis, and nodes wait for other nodes to come online so that the majority can be established

    在沒有多數的情況下,群集服務將暫時設置為脫機狀態,并且節點等待其他節點聯機,以便可以建立多數

Windows故障轉移群集的仲裁模式 (Quorum Modes for Windows Failover Cluster)

In the previous section, we overviewed the Windows Cluster Quorum tool. Based on the information, we can set the following formula for the majority in a cluster.

在上一節中,我們概述了Windows群集仲裁工具。 根據這些信息,我們可以為群集中的大多數設置以下公式。

Quorum = FLOOR (N/2+1)

法定人數=樓層(N / 2 + 1)

Where N=number of nodes.

其中N =節點數。

Suppose we have four nodes Cluster and each cluster nodes runs a SQL Server instance.

假設我們有四個節點Cluster,每個群集節點運行一個SQL Server實例。

Failover Cluster


As per the above formula, we require three votes for the cluster to remain online.


根據上述公式,我們需要三票才能使群集保持在線。

Quorum= 4/2 +1 = 3

法定人數= 4/2 +1 = 3

Now imagine the scenario

現在想象一下場景

  • Node 1 and Node 2 cannot communicate between Node 3 and Node 4. Node 1 and Node 2 can communicate with each other

    節點1和節點2無法在節點3和節點4之間通信。節點1和節點2可以彼此通信。
  • Node 3 and Node 4 cannot communicate between Node 1 and Node 2. Node 3 and Node 4 can communicate with each other

    節點3和節點4無法在節點1和節點2之間通信。節點3和節點4可以彼此通信。

Windows Failover Cluster scenerios

In this scenario, Node 1 and Node 2 tries to bring the resources online that is owned by Node 3 and Node 4. Similarly, Node 3 and Node 4 tries to bring the resources online that are owned by Node 1 and Node 2.

在這種情況下,節點1和節點2嘗試使節點3和節點4擁有的資源聯機。類似地,節點3和節點4嘗試使節點1和節點2擁有的資源聯機。

To avoid these scenarios, we have various Quorum configurations, and we should set the Quorum configuration carefully.

為避免這些情況,我們有各種Quorum配置,我們應該仔細設置Quorum配置。

Let’s discuss these Quorum configuration modes.

讓我們討論這些Quorum配置模式。

Windows故障轉移群集中的節點多數仲裁配置模式 (Node Majority Quorum configuration mode in Windows Failover Cluster)

In the Node Majority, each cluster node contributes a Vote. This Quorum configuration handles a loss of half of the cluster nodes after rounding off to a lower number.

在“多數節點”中,每個群集節點都參與投票。 四舍五入到較小的數量后,此仲裁配置處理了一半群集節點的丟失。

It is a recommended method to use with an odd number of cluster nodes.

建議使用奇數個群集節點的方法。

Let’s say we have three cluster nodes, and one node is not able to communicate with the other nodes. In this case, as shown in the following image, we have the node majority with two online nodes.

假設我們有三個群集節點,一個節點無法與其他節點通信。 在這種情況下,如下圖所示,我們擁有大多數節點和兩個在線節點。

Node majority configuration

Similarly, in the case of five nodes cluster, it can handle up to two nodes failures.

同樣,在五個節點群集的情況下,它最多可以處理兩個節點故障。

Windows故障轉移群集中的“節點和磁盤多數仲裁”配置模式 (Node & Disk Majority Quorum configuration mode in Windows Failover Cluster)

In this Quorum configuration mode, each cluster node gets one vote, and additionally, one vote comes from clustered disk (quorum disk). This disk can be a small size high available disk and should be part of the cluster group. It is suitable for a cluster with even nodes. Quorum disk also stores the cluster configuration data. Usually, Windows administrators set the size of the Quorum disk as 1 GB.

在此Quorum配置模式下,每個群集節點都將獲得一票,另外,一票來自群集磁盤(仲裁磁盤)。 該磁盤可以是小型高可用磁盤,并且應該是群集組的一部分。 它適用于具有偶數節點的集群。 仲裁磁盤還存儲群集配置數據。 通常,Windows管理員將Quorum磁盤的大小設置為1 GB。

Windows Failover Cluster Node and disk majority configuration

Let’s say Node 1 and Node 2 are down. We still have three votes to bring the cluster services online.

假設節點1和節點2處于關閉狀態。 我們仍然有三票可以使群集服務聯機。

Node and disk majority scenerio

If one more node also fails and we have only one node and one quorum disk to Vote, cluster services are offline in this case.

如果另外一個節點也發生故障,并且我們只有一個節點和一個仲裁磁盤要投票,則在這種情況下群集服務將處于脫機狀態。

Windows故障轉移群集中的“節點和文件共享多數仲裁”配置模式 (Node & File Share Majority Quorum configuration mode in the Windows Failover Cluster)

Node and File Share Majority is similar to the previous Node and Disk Majority quorum modes. In this case, we replace the quorum disk with a file share witness (FSW). FSW also cast a single vote similar to a quorum disk.

多數節點和文件共享類似于先前的多數節點和磁盤仲裁模式。 在這種情況下,我們用文件共享見證(FSW)替換仲裁磁盤。 FSW還進行了一次與法定磁盤類似的投票。

We might have windows cluster in different regions and might not have shared storage between them. File Share witness is a file share, and we can configure it on any server present in the active directory, and all cluster nodes should have access to that network share. It does not contain any configuration data. The active cluster node places a lock on the file share, and the file share witness contains the information about the owner.

我們可能在不同區域具有Windows群集,并且它們之間可能沒有共享存儲。 文件共享見證是文件共享,我們可以在活動目錄中存在的任何服務器上對其進行配置,并且所有群集節點都應有權訪問該網絡共享。 它不包含任何配置數據。 活動群集節點將鎖定文件共享,并且文件共享見證包含有關所有者的信息。

Node & File Share Majority

If the File share Witness is not available, the cluster remains online because of the majority of votes.

如果“文件共享見證”不可用,則由于多數投票,群集保持聯機狀態。

Node & File Share Majority scenerios

沒有多數:Windows故障轉移群集中的僅磁盤仲裁配置模式 (No Majority: Disk Only Quorum configuration mode in Windows Failover Cluster)

In this configuration, only witness disk has a vote, and cluster nodes cannot act as a voter. In this case, the witness disk acts as a single point of failure, and if it is not available or corrupted, the entire cluster is down. It is not a recommended quorum configuration.

在此配置中,只有見證磁盤具有投票權,并且群集節點不能充當投票器。 在這種情況下,見證磁盤充當單個故障點,并且如果它不可用或損壞,則整個群集都將關閉。 這不是推薦的仲裁配置。

In the following image, you can see once the Witness disk is not available, the entire cluster is down.

在下圖中,您可以看到一旦見證磁盤不可用,整個集群就會關閉。

No Majority: Disk Only

Windows故障轉移群集中的動態仲裁配置模式 (Dynamic Quorum configuration mode in Windows Failover Cluster)

Windows Server 2012 introduced a new feature Dynamic Quorum. It is enabled by default. In this configuration, the Windows Failover Cluster dynamically calculates the quorum as per the state of the active voters. If a node is down, the cluster group does not count its vote for the quorum calculation. Once the node rejoins the cluster, it is assigned a quorum vote. We can increase or decrease the quorum votes by using the dynamic quorum to keep the cluster running. Quorum votes are dynamically adjusted if the sum of votes is less than three in a multi-node cluster configuration.

Windows Server 2012引入了新功能動態仲裁。 默認情況下啟用。 在這種配置中,Windows故障轉移群集根據活動投票者的狀態動態計算仲裁。 如果某個節點發生故障,則群集組將不計算其投票來進行仲裁計算。 節點重新加入群集后,將為其分配仲裁投票。 通過使用動態仲裁來保持群集運行,我們可以增加或減少仲裁投票。 如果在多節點群集配置中票數之和小于3,則會動態調整仲裁票數。

We should add a witness to the even number of nodes. If a particular node is down, you might leave with the even number of nodes that might be a problematic situation.

我們應該為偶數個節點添加見證。 如果特定節點發生故障,則可能會留下偶數個節點,這可能會帶來問題。

Windows Server 2012 R2 also enables the Dynamic Witness once the dynamic quorum is configured. By using this feature, the Witness vote is dynamically adjusted. If we have an odd number of quorum votes in the cluster configuration, it does not use dynamic quorum witness. In the case of even number of votes, dynamic quorum also cast a vote. We can configure either File Share Witness or Disk witness as part of dynamic witness configuration. We can also use Cloud witness starting from Windows Server 2016.

一旦配置了動態仲裁,Windows Server 2012 R2還將啟用“動態見證”。 通過使用此功能,可以動態調整見證投票。 如果群集配置中的法定投票數為奇數,則它不使用動態法定見證。 在票數偶數的情況下,動態仲裁也會投票。 我們可以將文件共享見證或磁盤見證配置為動態見證配置的一部分。 從Windows Server 2016開始,我們還可以使用Cloud見證。

It works on the following concepts.

它適用于以下概念。

  • For the even number of nodes, each node has a vote and the witness dynamic vote

    對于偶數節點,每個節點都有一個投票,而見證人動態投票
  • For the odd number of nodes, each node has a vote, but the witness dynamic vote does not count. ( Witness dynamic Vote= 0)

    對于奇數個節點,每個節點都有一個投票,但見證人動態投票不計算在內。 (見證動態投票= 0)

Let’s understand dynamic quorum using an example. Suppose we have four nodes in a failover cluster.

讓我們通過一個示例來了解動態仲裁。 假設我們在故障轉移群集中有四個節點。

Dynamic Quorum overview

Each node can cast a Vote, and we require (4/2+1) three votes for the majority.

每個節點都可以投票,我們需要(4/2 + 1)三票贊成。

Let’s say Node 1 is down. The cluster will be up as we still have three votes that are required for the majority.

假設節點1發生故障。 由于我們仍然需要多數票的三票,因此集群將會建立。

Dynamic Quorum with one node down

Now, Node 2 is down as well. In this case as well, the cluster will remain online because of the dynamic quorum casted one vote.

現在,節點2也處于關閉狀態。 同樣,在這種情況下,由于動態的法定投票數,群集將保持在線狀態。

Dynamic Quorum with two node down

At this time, Node 3 is down as well. Using the dynamic quorum, we determine the majority based on the available nodes. Due to this, we still can have cluster service up.

此時,節點3也處于關閉狀態。 使用動態仲裁,我們根據可用節點確定多數。 因此,我們仍然可以啟動群集服務。

The total number of votes required for a quorum is now determined based on the number of nodes available. Therefore, with a dynamic quorum, the cluster will stay up even if you lose three nodes. This situation is called as last-man-standing in which cluster works with a single node as well.

現在,基于可用節點數來確定仲裁所需的投票總數 。 因此,使用動態仲裁,即使丟失三個節點,群集也將保持正常運行。 這種情況稱為“最后站立式”,其中群集也與單個節點一起工作。

Dynamic Quorum with three node down

結論 (Conclusion)

In this article, we explored the concepts of Windows Failover Cluster Quorum modes that are necessary for a SQL Server Always on Availability Group configuration. You should consider the pros and cons of each approach as per your configuration. You should select the quorum modes as per the requirements and should test failover to avoid issues in the production environment.

在本文中,我們探討了Windows故障轉移群集仲裁模式的概念,這些模式對于SQL Server始終可用可用性組配置是必需的。 您應根據自己的配置考慮每種方法的優缺點。 您應該根據需求選擇仲裁模式,并應該測試故障轉移,以避免生產環境中出現問題。

翻譯自: https://www.sqlshack.com/windows-failover-cluster-quorum-modes-in-sql-server-always-on-availability-groups/

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/5/144823.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息