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 Availability Groups.

这是该系列的综合指南SQL Server始终在可用性组的 5条。

介绍 (Introduction)

In the previous articles (see TOC at the bottom), we configured a two-node SQL Server Always On Availability Group. We performed the following steps at a high level.

在之前的文章(请参阅底部的TOC )中,我们配置了两个节点SQL Server Always On可用性组。 我们从总体上执行了以下步骤。

  • Build three Virtual Servers with Windows Server 2016
    • SQLNode1 and SQLNode2 acts as failover cluster nodes
    • VDITest3 works as a domain controller and active directory

    使用Windows Server 2016构建三个虚拟服务器
    • SQLNode1和SQLNode2充当故障转移群集节点
    • VDITest3充当域控制器和活动目录
  • Configured Domain Controller for [MyDemoSQL] domain, Active Directory in Windows Server 2016

    为[MyDemoSQL]域,Windows Server 2016中的Active Directory配置的域控制器
  • Join SQLNode1 and SQLNode2 into [MyDemoSQL] domain

    将SQLNode1和SQLNode2加入[MyDemoSQL]域
  • Failover Cluster, Quorum and Storage configurations

    故障转移群集,仲裁和存储配置
  • SQL Server 2019 installation

    SQL Server 2019安装
  • Synchronous mode Always On configurations for SQLNode1 and SQLNode2

    SQLNode1和SQLNode2的同步模式Always On配置

Suppose you get a requirement to add a new node in the existing cluster and always on configuration.

假设您需要在现有集群中添加一个新节点,并且始终处于配置状态。

In this article, we will learn the steps to add a new node in the existing AG configuration.

在本文中,我们将学习在现有AG配置中添加新节点的步骤。

  • Note: In this article, we will go over the required steps at a high-level. The previous article in this series already covers the things in detail.

    注意:在本文中,我们将简要介绍所需的步骤。 本系列的上一篇文章已经详细介绍了这些内容。

将新节点添加到现有SQL Server Always On可用性组中的步骤 (Steps to add a new node into existing SQL Server Always On Availability Groups)

服务器构建 (Server build)

Build a new virtual machine in the Oracle VirtualBox. Its configurations should be similar to existing cluster nodes SQLNode1 and SQLNode2. You can follow this article, A comprehensive guide to SQL Server Always On Availability Groups on Windows Server 2016 for reference purposes.

在Oracle VirtualBox中构建一个新的虚拟机。 其配置应类似于现有群集节点SQLNode1和SQLNode2。 您可以按照本文Windows Server 2016上SQL Server Always On可用性组综合指南进行参考。

Take an RDP session for the newly created VM and log in using the Administrator account.

为新创建的VM进行RDP会话,并使用管理员帐户登录。

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

分配静态IP地址 (Assign static IP address )

Open the network properties for Ipv4 and assign a static IP, DNS server IP as per your earlier configurations.

打开Ipv4的网络属性,并根据您的早期配置分配静态IP,DNS服务器IP。

  • In our case, DNS server IP address is 10.0.2.15

    在我们的情况下,DNS服务器IP地址为10.0.2.15
  • I assign IP address 10.0.2.44 for the new VM.

    我为新VM分配了IP地址10.0.2.44。

You can refer to the article, Configure Domain Controller and Active Directory for SQL Server Always On Availability Groups for static IP assignments.

您可以参考为SQL Server Always On可用性组配置域控制器和Active Directory进行静态IP分配的文章。

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

关闭Windows防火墙 (Turn off the Windows firewall)

You should turn off firewalls in your new virtual machine. If you use the firewall, you should open the ports for communication with the domain controller and failover cluster nodes.

您应该关闭新虚拟机中的防火墙。 如果使用防火墙,则应打开端口以与域控制器和故障转移群集节点进行通信。

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

主机名和IP验证 (Hostname and IP Verification)

Verify the hostname and IP address for the new VM. You can use the HOSTNAME and IPCONFIG commands for this purpose.

验证新虚拟机的主机名和IP地址。 为此,可以使用HOSTNAME和IPCONFIG命令。

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

Verify ping response from the SQLNode3 to the Domain Controller IP address.

验证从SQLNode3到域控制器IP地址的ping响应。

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

将SQLNode3添加为域成员 (Add SQLNode3 as a domain member)

Add the SQLNode3 as a member of [MyDemoSQL] domain: Open the server manager and click on the workgroup.

将SQLNode3添加为[MyDemoSQL]域的成员:打开服务器管理器,然后单击工作组。

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

In the Computer name/domain changes section, enter the domain name, authenticate with domain admin credentials and restart the system after you get a Welcome message.

在“计算机名称/域名更改”部分中,输入域名,使用域管理员凭据进行身份验证,并在收到“欢迎”消息后重新启动系统。

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

You should log in with the domain credential after a server reboot.

服务器重新引导后,您应该使用域凭据登录。

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

启用故障转移群集功能 (Enable Failover Cluster feature)

Enable Failover Clustering from the Add Roles and Features Wizard.

从“添加角色和功能”向导中启用故障转移群集

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

Now, we need to add this new node to the existing cluster. Launch failover cluster manager and click on Add Node.

现在,我们需要将此新节点添加到现有集群中。 启动故障转移群集管理器,然后单击添加节点。

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

将新节点添加到现有故障转移群集中 (Add a new node into the existing failover cluster)

It opens the Add Node Wizard. You should run a cluster validation to know any existing issues in the cluster.

它打开添加节点向导。 您应该运行集群验证以了解集群中的任何现有问题。

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

Click Next and enter the hostname of the newly created virtual machine. This server is a member of the domain; therefore, it shows you FQDN of the server.

单击下一步,然后输入新创建的虚拟机的主机名。 该服务器是域的成员; 因此,它显示了服务器的FQDN。

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

You get a validation warning because we haven’t performed the failover cluster validation with the existing and new virtual machine.

您收到验证警告,因为我们尚未对现有和新虚拟机执行故障转移群集验证。

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

We selected the cluster validation option; therefore, it opens the cluster validation wizard.

我们选择了集群验证选项; 因此,它将打开群集验证向导。

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

In the cluster validation, it checks the configuration for the cluster, Hyper-V configuration. Storage, inventory and system configuration. We can choose specific tests or run all validation tests. I would recommend you to run all tests for validation.

在群集验证中,它将检查群集的配置,即Hyper-V配置。 存储,库存和系统配置。 我们可以选择特定的测试或运行所有验证测试。 我建议您运行所有测试以进行验证。

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

You get progress status for every validation tests. Few tests might not be valid for your configuration. In this case, you get the result as the test is not applicable.

您将获得每个验证测试的进度状态。 很少有测试可能对您的配置无效。 在这种情况下,您将获得结果,因为该测试不适用。

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

Finally, once all the tests are completed, you can open the validation report and fix issues, if required.

最后,所有测试完成后,您可以打开验证报告并根据需要解决问题。

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

On the next page, you get a confirmation page that the new node is ready to add nodes in the existing cluster.

在下一页上,您将获得一个确认页面,确认新节点已准备好在现有集群中添加节点。

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

Click Next, and you get the message once it successfully adds the node into an existing failover cluster.

单击“下一步”,将节点成功添加到现有故障转移群集后,您会收到消息。

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

Click Finish. Launch the failover cluster manager and click on Nodes. Here, you can verify that all three nodes are part of the failover cluster. Each node is eligible for a vote to determine resource majority.

单击完成。 启动故障转移群集管理器,然后单击“节点”。 在这里,您可以验证所有三个节点是否都属于故障转移群集。 每个节点都有资格投票以确定资源多数。

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

安装SQL Server 2019并启用AG功能
(Install SQL Server 2019 and enable AG feature
)

The next step is to install SQL Server 2019 on the new virtual machine. In a SQL Server Always On Availability Group, we install SQL Server as a standalone configuration. You can refer to the article, Install SQL Server 2019 on Windows Server 2016 with SQL Server Always On Availability Groups to learn more about this.

下一步是在新的虚拟机上安装SQL Server 2019。 在SQL Server始终可用性组中,我们将SQL Server作为独立配置安装。 您可以参考文章SQL Server Always On可用性组在Windows Server 2016上安装SQL Server 2019来了解更多信息。

The below screenshot shows a successful database engine service installation on the new virtual machine SQLNode3.

以下屏幕快照显示了在新虚拟机SQLNode3上成功安装数据库引擎服务的过程。

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

Now, enable Always on Availability Groups features in the SQL Server Configuration Manager of the SQLNOde3. You must restart SQL Services after enabling AG features.

现在,在SQLNOde3SQL Server配置管理器中启用“始终在可用性组”功能。 启用AG功能后,必须重新启动SQL Services。

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

验证SQL Server Always On可用性组仪表板运行状况 (Verify SQL Server Always On Availability Groups dashboard health)

Connect to the primary always on replica and view dashboard. It should show healthy always on the dashboard. If there are any data synchronization issues, you should fix them before adding the 3rd node in AG configuration. It helps you to troubleshoot issues in case of any failures after the 3rd node configuration.

始终连接到副本数据库上的主数据库并查看仪表板。 它应该始终在仪表板上显示健康。 如果有任何数据同步问题,您应该AG配置中添加第三节点之前解决这些问题。 如果在第三个节点配置后出现任何故障,它可以帮助您解决问题。

You get a healthy AG replica with no expected data loss for existing SQLNode1 and SQLNode2.

您将获得一个健康的AG副本,并且不会对现有SQLNode1和SQLNode2造成预期的数据丢失。

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

SQL Server网络配置 (SQL Server network configurations)

You should also verify the TCP port for SQL Server connections. You should use a static TCP port. In case your SQL instance uses a dynamic port, open the SQL Server Configuration Manager and TCP/IP protocol properties. On this page, set the static port. By default, SQL Server works on the TCP port 1433.

您还应该验证用于SQL Server连接的TCP端口。 您应该使用静态TCP端口。 如果您SQL实例使用动态端口,请打开“ SQL Server配置管理器”和TCP / IP协议属性。 在此页面上,设置静态端口。 默认情况下,SQL Server在TCP端口1433上工作。

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

在新的副本SQL实例上还原SQL Server Always On可用性组数据库 (Restore SQL Server Always On Availability Group database on the new replica SQL instance)

Before adding the new node into AG configuration, restore a full backup and subsequent transaction log backup of the AG database from the primary replica to the new server SQL instance. This database should be in the restoring (Norecovery) mode.

在将新节点添加到AG配置之前,将AG数据库的完整备份和后续事务日志备份从主副本还原到新服务器SQL实例。 该数据库应处于还原(无恢复)模式。

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

将副本添加到现有的始终存在的副本中 (Add replica into existing always on replica )

In the primary replica instance, right-click on the SQL Server Always On Availability Group and choose Add Replica.

在主副本实例中,右键单击“ SQL Server Always On可用性”组,然后选择“添加副本”。

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

It opens the wizard to add replica into an existing availability group. The wizard gives you a high-level summary of the further steps as well.

它打开向导以将副本添加到现有可用性组中。 该向导还为您提供了进一步步骤的高级摘要。

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

On the next page, it asks you to connect to existing replicas. We are already connected to the primary replica using SSMS. Therefore, you see it highlights secondary AG replica for connection.

在下一页上,它要求您连接到现有副本。 我们已经使用SSMS连接到主副本。 因此,您会看到它突出显示了用于连接的辅助AG副本。

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

Click Next, and you can see existing configuration for replica, endpoint, backups, listener and read-only routing.

单击“下一步”,您可以看到副本,端点,备份,侦听器和只读路由的现有配置。

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

Click on Add Replica, specify SQL Instance name for the new instance that we wish to join into existing AG replica and connect to it. You have an option to choose either the synchronous or asynchronous data commit mode. If you click on an automatic failover checkbox, it automatically selects the synchronous commit mode.

单击添加副本 ,为我们希望加入现有AG副本并连接到它的新实例指定SQL实例名称。 您可以选择同步或异步数据提交模式。 如果单击自动故障转移复选框,它将自动选择同步提交模式。

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

On the next page, select the data synchronization method. We already restored a database copy in the SQLNode3 from the primary replica; therefore, choose the method as Join only.

在下一页上,选择数据同步方法。 我们已经从主副本中恢复了SQLNode3中的数据库副本。 因此,请选择“ 仅加入 ”方法。

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

Add replica wizard performs validations as per your inputs.

添加副本向导将根据您的输入执行验证。

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

View the summary of the add replica wizard tasks. You can also generate a script for your actions or click on Finish to complete the wizard actions.

查看添加副本向导任务的摘要。 您也可以为操作生成脚本,或单击“完成”以完成向导操作。

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

On the next page, you see the status of each task it took to add a node in the existing SQL Server Always on Availability Group.

在下一页上,您将看到在现有SQL Server Always on可用性组中添加节点所花费的每个任务的状态。

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

Launch the AG dashboard, and it shows all SQL instances in the synchronized mode. It might take time for the dashboard to become healthy depending upon the transactions performed after the backups.

启动AG仪表板,它以同步模式显示所有SQL实例。 根据备份后执行的事务,仪表板可能需要一些时间才能恢复正常。

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

In the failover cluster manager, open the listener properties, and it has all nodes in the preferred owner’s list.

在故障转移群集管理器中,打开侦听器属性,它的所有节点都在首选所有者的列表中。

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

SQL Server Always On可用性组的故障转移测试
(Failover testing for the SQL Server Always on Availability group
)

We should perform a failover testing as well after adding a new node into the existing AG configurations. In the failover wizard, you should verify the failover readiness. It should show status as No data loss for a successful failover without any estimated data loss.

在将新节点添加到现有的AG配置中之后,我们也应该执行故障转移测试。 在故障转移向导中,您应该验证故障转移的准备情况。 对于成功的故障转移,它应显示为“ 无数据丢失 ”的状态,并且没有任何估计的数据丢失。

Select the new primary replica (in my case SQLNode3) and click on Next.

选择新的主副本(在我的示例中为SQLNode3),然后单击“下一步”。

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

Connect to the new primary replica.

连接到新的主副本。

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

Verify your choice of the new AG replica. It also shows you the affected databases as part of this failover. We have configured [SQLShackDemo] in the AG replica, so you get this database name in the list.

验证您对新AG副本的选择。 它还会在此故障转移中向您显示受影响的数据库。 我们已经在AG副本中配置了[SQLShackDemo],因此您可以在列表中获得此数据库名称。

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

Click Finish to initial failover process, and it performs a manual failover successfully as shown below.

单击“完成”以进行初始故障转移过程,它将成功执行手动故障转移,如下所示。

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

Verify the new replica and data synchronization status using the AG dashboard.

使用AG仪表板验证新副本和数据同步状态。

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

You can also verify that the failover cluster owner is the new primary replica SQLNode3.

您还可以验证故障转移群集所有者是新的主副本SQLNode3。

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

结论 (Conclusion)

In this article, we walk through the process to add a node into the existing SQL Server Always On Availability Group. We will further explore the availability group related configurations in the upcoming articles of this series.

在本文中,我们将逐步完成将节点添加到现有SQL Server Always On可用性组的过程。 我们将在本系列的后续文章中进一步探讨与可用性组相关的配置。

目录 (Table of contents)

A comprehensive guide to SQL Server Always On Availability Groups on Windows Server 2016
Configure Domain Controller and Active Directory for SQL Server Always On Availability Groups
Configure failover clusters, storage controllers and quorum configurations for SQL Server Always On Availability Groups
Install SQL Server 2019 on Windows Server 2016 with SQL Server Always On Availability Groups
Add a new node into existing SQL Server Always On Availability Groups
Configure Managed Service Accounts for SQL Server Always On Availability Groups
Windows Server 2016上SQL Server Always On可用性组的全面指南
为SQL Server Always On可用性组配置域控制器和Active Directory
为SQL Server Always On可用性组配置故障转移群集,存储控制器和仲裁配置
在Windows Server 2016和SQL Server Always On可用性组上安装SQL Server 2019
将新节点添加到现有SQL Server Always On可用性组中
为SQL Server Always On可用性组配置托管服务帐户

翻译自: https://www.sqlshack.com/add-a-new-node-into-existing-sql-server-always-on-availability-groups/

sql server父节点