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.

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 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故障转移群集仲裁投票配置。

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实例。

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可以彼此通信。

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.

假设我们有三个群集节点,一个节点无法与其他节点通信。 在这种情况下,如下图所示,我们拥有大多数节点和两个在线节点。

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。

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

假设节点1和节点2处于关闭状态。 我们仍然有三票可以使群集服务联机。

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群集,并且它们之间可能没有共享存储。 文件共享见证是文件共享,我们可以在活动目录中存在的任何服务器上对其进行配置,并且所有群集节点都应有权访问该网络共享。 它不包含任何配置数据。 活动群集节点将锁定文件共享,并且文件共享见证包含有关所有者的信息。

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

如果“文件共享见证”不可用,则由于多数投票,群集保持联机状态。

没有多数: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.

在下图中,您可以看到一旦见证磁盘不可用,整个集群就会关闭。

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.

让我们通过一个示例来了解动态仲裁。 假设我们在故障转移群集中有四个节点。

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发生故障。 由于我们仍然需要多数票的三票,因此集群将会建立。

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也处于关闭状态。 同样,在这种情况下,由于动态的法定投票数,群集将保持在线状态。

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.

现在,基于可用节点数来确定仲裁所需的投票总数 。 因此,使用动态仲裁,即使丢失三个节点,群集也将保持正常运行。 这种情况称为“最后站立式”,其中群集也与单个节点一起工作。

结论 (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/

SQL Server Always On可用性组中的Windows故障转移群集仲裁模式相关推荐

  1. sql server父节点_将新节点添加到现有SQL Server Always On可用性组中

    sql server父节点 This is the 5th article in the series of a comprehensive guide to SQL Server Always On ...

  2. SQL Server Always On可用性组中的数据同步

    This article describes the data synchronization process on SQL Server Always On Availability Groups ...

  3. 为SQL Server Always On可用性组配置故障转移群集,存储控制器和仲裁配置

    This article explores the configuration of Windows failover clusters, storage controllers and quorum ...

  4. Windows Server 2016上SQL Server Always On可用性组的全面指南

    In this article, we will configure a SQL Server Always On Availability Group on the Windows Server 2 ...

  5. 在Windows Server 2016和SQL Server Always On可用性组上安装SQL Server 2019

    In this article, we will proceed with configuring a SQL Server Always On Availability Groups and per ...

  6. 为SQL Server Always On可用性组配置托管服务帐户

    This article is a 6th article in the series for SQL Server Always On Availability Groups. It covers ...

  7. 思科模拟器划分子网实验报告_模拟多子网群集以设置SQL Server Always On可用性组–实验设置

    思科模拟器划分子网实验报告 In this article, we are going to see how to create a multi subnet cluster spanning acr ...

  8. aws ec2 选择可用区_在AWS EC2上配置SQL Server Always On可用性组

    aws ec2 选择可用区 In this article, we will review how to set up multi-subnet Always On Availability grou ...

  9. sql always on_Always On可用性组中具有发布者数据库SQL复制

    sql always on In this article, we will review how to setup SQL replication with publisher database i ...

最新文章

  1. 不抓包,如何学得了 TCP
  2. 给列名称命名_批量提取文件名,然后换上新名称
  3. web开发者工具,261页前端面试题宝典,通用流行框架大全
  4. 基于特征的文法分析以及概述自然语言处理
  5. go 数组任意位置插入数字类型的元素
  6. k8s源码Client-go中Reflector解析
  7. 【Level 09】U1 The way I see it L3 At your service
  8. argument type mismatch怎么解决_iPhone用户超10亿,iphone12隐藏优势终于被发现了_Type...
  9. 【建站知识】如何让我们的网站更快?如何开启全站阿里域名加速?...
  10. restTemplate请求,报 : No instances avaliable for ip地址
  11. java web编码详解_Java Web 之编解码分析
  12. hive表列字段显示
  13. python简单的分析文本
  14. window 7 计算机配置,Windows7操作系统要求电脑配置
  15. Linux/windows下java调用lingo
  16. Mac制作Windows 10 U盘启动盘
  17. 再听 ,抖音视频背景制作---小龙老师
  18. 数码管:3位6脚的数码管分析和编码
  19. python 爬取链家网北京租房信息
  20. 《魔界地牢:异世界战纪》隐私政策

热门文章

  1. oppo面经-java开发
  2. Linux环境CentOS6.9安装配置Elasticsearch6.2.2最全详细教程
  3. 数据库设计的三大范式通俗解释
  4. Myeclipse快键键
  5. spring实战三装配bean之Bean的作用域以及初始化和销毁Bean
  6. 操作系统---页面置换算法
  7. 图解HTTP笔记(一)
  8. python安装不了怎么办_python安装运行时提示不是内部或外部命令怎么办
  9. 电脑能开机但进不去系统,电脑只能进安全模式怎么处理?
  10. 一个人开长途车旅游安全吗?