创建工作组群集

阅读本文,了解并创建工作组群集。 首先,了解什么是工作组群集,以及它们与传统故障转移群集有何不同。 然后,使用故障转移群集管理器或 Windows PowerShell 创建工作组群集。

了解工作组群集

工作组群集是 Windows Server 2016 中引入的一种特定类型的故障转移群集配置。 使用工作组群集时,两个或多个节点作为成员服务器连接。 它们不使用本地域控制器或 Active Directory 林。 工作组群集没有加入域,而是加入了工作组。 它们仍然需要使用域名系统 (DNS)。

通常,故障转移群集是 Active Directory 域服务域的一部分,可大规模提供标识服务和管理。 但是,在某些情况下,你可能想要在没有 Active Directory 的情况下运行故障转移群集,以减少硬件、维护和其他操作开销的成本。

工作组群集提供集中式标识和相同的高安全性,以保持应用程序的高可用性。 通过不使用 Active Directory,客户仍然可以以较低的成本实现高可用性。

Prerequisites

工作组群集必须满足以下先决条件,才能满足官方支持的部署条件:

  • 所有用作工作组群集节点的服务器都运行相同版本的 Windows Server。
  • 所有工作组群集节点都必须在一个工作组中,并且不能加入 Active Directory 域。 以前在 Active Directory 域中的任何节点不仅必须移动到工作组,还必须重命名以删除任何 Active Directory 缓存。
  • 群集必须配置以下存储技术之一,并可供所有群集节点使用。 若要了解有关故障转移群集存储要求的详细信息,请参阅故障转移群集存储要求
    • Storage Spaces Direct (S2D)。 如果要创建存储空间直通群集,请查看存储空间直通硬件要求
    • SAN 附加存储。
    • 使用 SMB 3.0 或更高版本的 NAS。
  • 查看如何为群集配置仲裁,以确定最适合要求的仲裁类型。 可以使用云见证、磁盘见证或 USB 见证。

Cluster workloads

工作组群集支持多种工作负载。 建议并支持以下方面的工作组群集:

  • Hyper-V VMs. 从 Windows Server 2025 开始支持的群集工作负载。
  • SQL Server 可用性组。 SQL Server 是 Windows Server 2016 至 Windows Server 2025 支持的工作负载。 若要部署 SQL Server 工作负载,请按照说明创建独立于域的可用性组

以下情况不支持工作组群集:

  • File Servers. 由于身份验证问题,不支持。
  • SQL Server FCI。 Not supported.

创建双节点工作组群集

在以下部分中,你将使用能够托管 Hyper-V 虚拟机的 Storage Spaces Direct 存储创建双节点工作组群集。 该过程由以下步骤组成:

  1. 准备服务器。 每台服务器必须具有相同的用户帐户、填充的 Windows 远程管理 (WinRM) 信任主机列表和通用主 DNS 后缀。

  2. 安装故障转移群集功能。 每台服务器都必须安装故障转移群集功能。

  3. 验证配置。 运行验证测试以确认每个服务器节点都可以支持工作组群集。

  4. 创建工作组群集。 按照下面的步骤,使用预配置的服务器节点创建工作组群集。

步骤 1:准备服务器

首先,需要配置服务器。 这包括在每个服务器节点中创建一个相同的用户帐户,将服务器添加为受信任主机,并确保每个服务器都有一个通用主 DNS 后缀。 在群集的每个节点上执行以下步骤。

在每个节点上创建一致的管理员帐户

必须在每个节点上创建一致的管理员用户帐户。 这些帐户的用户名和密码在所有节点上必须相同,并且该帐户还必须添加到本地管理员组。

  1. 在每个节点上使用相同的用户名和密码创建一个新的用户帐户。

  2. 如果未使用非生成管理员帐户,则需要在注册表中设置 LocalAccountTokenFilterPolicy。 以下一组步骤介绍了如何设置 LocalAccountTokenFilterPolicy。

    Important

    此部分(或称方法或任务)介绍了修改注册表的步骤。 但是,注册表修改不当可能会出现严重问题。 因此,按以下步骤操作时请务必谨慎。 作为额外保护措施,请在修改注册表之前先将其备份。 如果之后出现问题,您就可以还原注册表。 有关如何备份和还原注册表的详细信息,请参阅如何备份和还原 Windows 中的注册表

  3. Click Start, click Run, type regedit, and then press ENTER.

  4. 找到并单击以下注册表子项:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

  5. 如果 LocalAccountTokenFilterPolicy 注册表项不存在,请执行以下步骤:

    1. On the Edit menu, point to New, and then select DWORD Value.
    2. Type LocalAccountTokenFilterPolicy, and then press ENTER.
  6. Right-click LocalAccountTokenFilterPolicy, and then select Modify.

  7. In the Value data box, type 1, and then select OK.

  8. 启动注册表编辑器。

确保节点是远程管理的受信任主机

每个服务器节点都必须作为受信任主机添加到 Windows 远程管理 (WinRM) 中。 为此,请为要连接到本地计算机的每个服务器添加一个条目来修改 TrustedHosts 文件。

  1. From the start menu, enter: gpedit.msc. “本地组策略编辑器”对话框将打开。

  2. 导航到本地计算机策略>计算机配置>管理模板>Windows 组件>Windows 远程管理 (WinRM)>WinRM 客户端>受信任主机

  3. In the Trusted Hosts dialog, select the Enabled radio button and then enter a comma separated list of trusted hosts by hostname.

  4. Select Apply and then OK.

  5. 在每个服务器节点上完成此过程。

设置主 DNS 后缀

按照以下步骤在每个服务器节点上设置主 DNS 后缀。

  1. In the Search bar, enter system properties and select View advanced system settings. This opens the System Properties dialog. In the Computer Name tab, select the Change... button.

  2. In the Computer Name/Domain Changes dialog, confirm that the Member of option selected is Workgroup. Then select the More... button.

  3. 在“DNS 后缀和 NetBIOS 计算机名称”对话框中,输入所选此计算机的主 DNS 后缀。 The select OK to close the dialog window.

  4. Select OK again to close the Computer Name/Domain Changes dialog, and then you're prompted to restart your computer to apply changes. Select OK to restart and follow the prompts to restart your computer now.

步骤 2:安装故障转移群集功能

安装故障转移群集功能(如果尚未安装)。

以下步骤演示如何在服务器管理器中安装故障转移群集功能。

  1. 启动服务器管理器。

  2. On the Manage menu, select Add Roles and Features.

  3. 在“开始之前”页面上,选择“下一步”。

  4. 在“选择安装类型”页面上,选择“基于角色或基于功能的安装”,然后选择“下一步”。

  5. 在“选择目标服务器”页上,选择你想要安装该功能的服务器,然后选择“下一步”。

  6. 在“选择服务器角色”页上,选择“下一步”。

  7. On the Select features page, select the Failover Clustering check box.

  8. To install the Failover Cluster management tools, select Add Features and then select Next.

  9. 在“确认安装选择”页上,选择“安装”。 无需为故障转移群集功能重启服务器。

  10. When the installation completes, select Close.

  11. 在你想要添加为故障转移群集节点的每个服务器上重复此过程。

步骤 3:创建工作组群集

现在,你已经准备好使用准备好的服务器节点创建工作组群集。 可以使用故障转移群集管理器Microsoft PowerShell

在创建故障转移群集之前,我们强烈建议你验证配置,以确保硬件和硬件设置与故障转移群集兼容。 仅当完整配置通过所有验证测试,并且针对运行群集节点的 Windows Server 版本认证了所有硬件时,Microsoft 才支持群集解决方案。

Note

必须至少有两个节点才能运行所有测试。 如果只有一个节点,则许多关键存储测试不会运行。

运行群集验证测试

  1. 在已从远程服务器管理工具安装了故障转移群集管理工具的计算机上,或在安装了故障转移群集功能的服务器上,启动故障转移群集管理器。 To do this on a server, start Server Manager and then on the Tools menu, select Failover Cluster Manager.

  2. 在“故障转移群集管理器”窗格的“管理”下,选择“验证配置”。

  3. 在“开始之前”页面上,选择“下一步”

  4. 选择服务器或群集页的输入名称框中,输入 NetBIOS 名称或你打算添加为故障转移群集节点的服务器的完全限定域名,然后选择添加。 为要添加的每台服务器重复此步骤。 若要同时添加多台服务器,请用逗号或分号分隔这些名称。 例如,以 server1.contoso.com, server2.contoso.com 格式输入名称。 When you finish, select Next.

  5. On the Testing Options page, select Run all tests (recommended) and then select Next.

  6. On the Confirmation page, select Next. 验证页面显示运行测试的状态。

  7. On the Summary page, do either of the following:

    • 如果结果指示测试已成功完成且该配置适用于群集,并且你想要立即创建该群集,请确保选中“立即使用已验证的节点创建群集”复选框,然后选择“完成”。 然后,继续执行创建工作组群集过程的步骤 4。
    • If the results indicate that there were warnings or failures, select View Report to view the details and determine which issues must be corrected. 请注意,特定验证测试的警告指示可以支持故障转移群集的这个方面,但是可能不符合推荐的最佳做法。

创建工作组群集

验证通过后,现在可以创建工作组群集。

Important

Microsoft 仅支持通过所有验证测试的群集。 若要运行验证测试,请完成“验证配置向导”,如运行群集验证测试中所述。

若要创建新群集,请完成以下步骤:

  1. 启动服务器管理器。

  2. On the Tools menu, select Failover Cluster Manager.

  3. 故障转移群集管理器窗格的管理下,选择创建群集。 将会打开“创建群集向导”。

  4. 在“开始之前”页面上,选择“下一步”

  5. If the Select Servers page appears, in the Enter name box enter the NetBIOS name or the fully qualified domain name of a server that you plan to add as a failover cluster node, and then select Add. 为要添加的每台服务器重复此步骤。 若要同时添加多台服务器,请用逗号或分号分隔这些名称。 For example, enter the names in the format server1.contoso.com; server2.contoso.com. When you're finished, select Next. 已验证的节点会自动添加到创建群集向导中,以便你无需再次输入它们。

  6. If you skipped validation earlier, the Validation Warning page appears. 我们强烈建议你运行群集验证。 若要运行验证测试,请完成“验证配置向导”,如运行群集验证测试中所述。

  7. 用于管理群集的访问点页上,输入想要用于管理群集的群集名称

    1. 如果该服务器没有配置为使用 DHCP 的网络适配器,则必须为该故障转移群集配置一个或多个静态 IP 地址。 选中你想要用于群集管理的每个网络旁边的复选框。 In the Address field next to a selected network, enter the IP address that you want to assign to the cluster. 此 IP 地址(或多个地址)将与域名系统 (DNS) 中的群集名称相关联。
    2. When you finish, select Next.
  8. On the Confirmation page, review the settings. 默认情况下,选中“将所有符合条件的存储添加到群集”复选框。 如果以后要配置存储,请清除此复选框。

  9. Select Next to create the failover cluster.

  10. On the Summary page, confirm that the failover cluster was successfully created. If there were any warnings or errors, view the summary output or select View Report to view the full report. Select Finish.

  11. 若要确认已创建群集,请验证该群集名称在导航树中的“故障转移群集管理器”下列出。 You can expand the cluster name and then select items under Nodes, Storage, or Networks to view the associated resources.

After the cluster is created, you can do things such as verify cluster quorum configuration, create clustered roles, and optionally, create Cluster Shared Volumes (CSV).