添加 RD 连接代理服务器以部署和配置高可用性Add the RD Connection Broker server to the deployment and configure high availability

适用于:Windows Server(半年频道)、Windows Server 2019、Windows Server 2016Applies to: Windows Server (Semi-Annual Channel), Windows Server 2019, Windows Server 2016

可以部署一个远程桌面连接代理(RD 连接代理)群集,用于提高远程桌面服务基础结构的可用性和可伸缩性。You can deploy a Remote Desktop Connection Broker (RD Connection Broker) cluster to improve the availability and scale of your Remote Desktop Services infrastructure.

先决条件Pre-requisites

设置一个服务器充当另一个 RD 连接代理 - 可以是物理服务器或 VM。Set up a server to act as a second RD Connection Broker—this can be either a physical server or a VM.

设置连接代理的数据库。Set up a database for the Connection Broker. 可以在本地环境中使用 Azure SQL 数据库实例或 SQL Server。You can use Azure SQL Database instance or SQL Server in your local environment. 下面讨论如何使用 Azure SQL,但这些步骤也适用于 SQL Server。We talk about using Azure SQL below, but the steps still apply to SQL Server. 需要找到该数据库的连接字符串,并确保已安装适当的 ODBC 驱动程序。You'll need to find the connection string for the database and make sure you have the correct ODBC driver.

步骤 1:配置连接代理的数据库Step 1: Configure the database for the Connection Broker

  1. 找到所创建的数据库的连接字符串 - 稍后在配置连接代理本身时(步骤 3),需要使用该连接字符串来识别所需 ODBC 驱动程序的版本,因此,请将该字符串保存到可方便参考的位置。Find the connection string for the database you created - you need it both to identify the version of ODBC driver you need and later, when you're configuring the Connection Broker itself (step 3), so save the string someplace where you can reference it easily. 下面说明了如何查找 Azure SQL 的连接字符串:Here's how you find the connection string for Azure SQL:
    1. 在 Azure 门户中,单击“浏览”>“资源组”,然后单击部署的资源组。 In the Azure portal, click Browse > Resource groups and click the resource group for the deployment.

    2. 选择刚刚创建的 SQL 数据库(例如 CB-DB1)。Select the SQL database you just created (for example, CB-DB1).

    3. 单击“设置” > “属性” > “显示数据库连接字符串”。 Click Settings > Properties > Show database connection strings.

    4. 复制“ODBC (包括 Node.js)”的连接字符串,如下所示: Copy the connection string for ODBC (includes Node.js), which should look like this:

      Driver={SQL Server Native Client 13.0};Server=tcp:cb-sqls1.database.windows.net,1433;Database=CB-DB1;Uid=sqladmin@contoso;Pwd={your_password_here};Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;
      
    5. 请将“your_password_here”替换为实际密码。Replace "your_password_here" with the actual password. 连接到数据库时,将使用此整个字符串以及包含的密码。You'll use this entire string, with your included password, when connecting to the database.

  2. 在新的连接代理上安装 ODBC 驱动程序:Install the ODBC driver on the new Connection Broker:
    1. 如果将 VM 用于连接代理,请为第一个 RD 连接代理创建公共 IP 地址。If you are using a VM for the Connection Broker, create a public IP address for the first RD Connection Broker. (仅当 RDMS 虚拟机尚不包含用于建立 RDP 连接的公共 IP 地址时,才需要执行此操作。)(You only have to do this if the RDMS virtual machine does not already have a public IP address to allow RDP connections.)
      1. 在 Azure 门户中,单击“浏览” > “资源组”,单击部署的资源组,然后单击第一个 RD 连接代理虚拟机(例如 Contoso-Cb1)。 In the Azure portal, click Browse > Resource groups, click the resource group for the deployment, and then click the first RD Connection Broker virtual machine (for example, Contoso-Cb1).
      2. 单击“设置”>“网络接口”,然后单击相应的网络接口。 Click Settings > Network interfaces, and then click the corresponding network interface.
      3. 单击“设置”>“IP 地址”。 Click Settings > IP address.
      4. 对于“公共 IP 地址”,请选择“已启用”,然后单击“IP 地址”。 For Public IP address, select Enabled, and then click IP address.
      5. 若要使用现有的公共 IP 地址,请从列表中选择它。If you have an existing public IP address you want to use, select it from the list. 否则,请单击“新建”并输入名称,然后依次单击“确定”、“保存”。 Otherwise, click Create new, enter a name, and then click OK and then Save.
    2. 连接到第一个 RD 连接代理:Connect to the first RD Connection Broker:
      1. 在 Azure 门户中,单击“浏览” > “资源组”,单击部署的资源组,然后单击第一个 RD 连接代理虚拟机(例如 Contoso-Cb1)。 In the Azure portal, click Browse > Resource groups, click the resource group for the deployment, and then click the first RD Connection Broker virtual machine (for example, Contoso-Cb1).
      2. 单击“连接”>“打开”以打开远程桌面客户端。 Click Connect > Open to open the Remote Desktop client.
      3. 在客户端中单击“连接”,然后单击“使用另一个用户帐户” 。In the client, click Connect, and then click Use another user account. 输入域管理员帐户的用户名和密码。Enter the user name and password for a domain administrator account.
      4. 收到有关证书的警告时,请单击“是” 。Click Yes when warned about the certificate.
    3. 下载与 ODBC 连接字符串中的版本匹配的适用于 SQL Server 的 ODBC 驱动程序Download the ODBC driver for SQL Server that matches the version in the ODBC connection string. 对于上面的示例字符串,我们需要安装 ODBC 驱动程序版本 13。For the example string above, we need to install the version 13 ODBC driver.
    4. 将 Sqlincli.msi 文件复制到第一个 RD 连接代理服务器。Copy the sqlincli.msi file to the first RD Connection Broker server.
    5. 打开 sqlincli.msi 文件并安装本机客户端。Open the sqlincli.msi file and install the native client.
    6. 针对其他每个 RD 连接代理(例如,Contoso-Cb2)重复步骤 1-5。Repeat steps 1-5 for each additional RD Connection Brokers (for example, Contoso-Cb2).
    7. 在要运行连接代理的每个服务器上安装 ODBC 驱动程序。Install the ODBC driver on each server that will run the connection broker.

步骤 2:在 RD 连接代理上配置负载均衡Step 2: Configure load balancing on the RD Connection Brokers

如果使用 Azure 基础结构,可以创建 Azure 负载均衡器;否则,可以设置 DNS 轮循机制If you are using Azure infrastructure, you can create an Azure load balancer; if not, you can set up DNS round-robin.

创建负载均衡器Create a load balancer

  1. 创建 Azure 负载均衡器Create an Azure Load Balancer
    1. 在 Azure 门户中,单击“浏览”>“负载均衡器”>“添加”。 In the Azure portal click Browse > Load balancers > Add.
    2. 输入新负载均衡器的名称(例如 hacb)。Enter a name for the new load balancer (for example, hacb).
    3. 为“方案”选择“内部”,选择部署的虚拟网络(例如 Contoso-VNet),并选择包含所有资源的子网(例如 default)。 Select Internal for the Scheme, Virtual Network for your deployment (for example, Contoso-VNet), and the Subnet with all of your resources (for example, default).
    4. 为“IP 地址分配”选择“静态”,并输入当前未使用的专用 IP 地址(例如 10.0.0.32)。 Select Static for the IP address assignment and enter a Private IP address that is not currently in use (for example, 10.0.0.32).
    5. 选择适当的订阅、包含所有资源的资源组,以及适当的位置Select the appropriate Subscription, the Resource group with all of your resources, and the appropriate Location.
    6. 选择“创建”。 Select Create.
  2. 创建一个探测用于监视哪些服务器处于活动状态:Create a probe to monitor which servers are active:
    1. 在 Azure 门户中,单击“浏览”>“负载均衡器”,然后单击刚刚创建的负载均衡器(例如 CBLB)。 In Azure portal, click Browse > Load Balancers, and then click the load balancer you just created, (for example, CBLB). 单击“设置” 。Click Settings.
    2. 单击“探测”>“添加”。 Click Probes > Add.
    3. 输入探测的名称(例如 RDP),选择“TCP”作为协议,输入 3389 作为端口,然后单击“确定”。 Enter a name for the probe (for example, RDP), select TCP as the Protocol, enter 3389 for the Port, and then click OK.
  3. 创建连接代理的后端池:Create the backend pool of the Connection Brokers:
    1. 在“设置”中,单击“后端地址池”>“添加”。 In Settings, Click Backend address pools > Add.
    2. 输入名称(例如 CBBackendPool),然后单击“添加虚拟机”。 Enter a name (for example, CBBackendPool), then click Add a virtual machine.
    3. 选择可用性集(例如 CbAvSet),然后单击“确定”。 Choose an availability set (for example, CbAvSet), and then click OK.
    4. 单击“选择虚拟机”,选择每个虚拟机,然后单击“选择”>“确定”>“确定”。 Click Choose the virtual machines, select each virtual machine, and then click Select > OK > OK.
  4. 创建 RDP 负载均衡规则:Create the RDP load balancing rule:
    1. 在“设置”中单击“负载均衡规则”,然后单击“添加”。 In Settings, click Load balancing rules, and then click Add.
    2. 输入名称(例如 RDP),为“协议”选择“TCP”作为协议,为“端口”和“后端端口”输入 3389,然后单击“确定”。 Enter a name (for example, RDP), select TCP for the Protocol, enter 3389 for both Port and Backend port, and click OK.
  5. 添加负载均衡器的 DNS 记录:Add a DNS record for the Load Balancer:
    1. 连接到 RDMS 服务器虚拟机(例如 Contoso-CB1)。Connect to the RDMS server virtual machine (for example, Contoso-CB1). 有关连接到 VM 的步骤,请查看准备 RD 连接代理 VM 一文。Check out the Prepare the RD Connection Broker VM article for steps on how you connect to the VM.
    2. 在服务器管理器中,单击“工具”>“DNS”。 In Server Manager, click Tools > DNS.
    3. 在左侧窗格中展开“DNS”,单击 DNS 计算机,单击“正向查找区域”,然后单击你的域名(例如 Contoso.com)。 In the left-hand pane, expand DNS, click the DNS machine, click Forward Lookup Zones, and then click your domain name (for example, Contoso.com). (可能需要花费几秒钟时间来处理对 DNS 服务器发出的信息查询。)(It might take a few seconds to process the query to the DNS server for the information.)
    4. 单击“操作”>“新建主机(A 或 AAAA)”。 Click Action > New Host (A or AAAA).
    5. 输入前面指定的名称(例如 hacb)和 IP 地址(例如 10.0.0.32)。Enter the name (for example, hacb) and the IP address specified earlier (for example, 10.0.0.32).

配置 DNS 轮循机制Configure DNS round-robin

下面是创建 Azure 内部负载均衡器的替代步骤。The following steps are an alternative to creating an Azure Internal Load Balancer.

  1. 在 Azure 门户中连接到 RDMS 服务器。Connect to the RDMS server in the Azure portal. 使用远程桌面连接客户端using Remote Desktop Connection client
  2. 创建 DNS 记录:Create DNS records:
    1. 在服务器管理器中,单击“工具”>“DNS”。 In Server Manager, click Tools > DNS.
    2. 在左侧窗格中展开“DNS”,单击 DNS 计算机,单击“正向查找区域”,然后单击你的域名(例如 Contoso.com)。 In the left-hand pane, expand DNS, click the DNS machine, click Forward Lookup Zones, and then click your domain name (for example, Contoso.com). (可能需要花费几秒钟时间来处理对 DNS 服务器发出的信息查询。)(It might take a few seconds to process the query to the DNS server for the information.)
    3. 依次单击“操作”、“新建主机(A 或 AAAA)”。 Click Action and New Host (A or AAAA).
    4. 输入 RD 连接代理群集的 DNS 名称(例如 hacb),然后输入第一个 RD 连接代理的 IP 地址Enter the DNS Name for the RD Connection Broker cluster (for example, hacb), and then enter the IP address of the first RD Connection Broker.
    5. 针对其他每个 RD 连接代理重复步骤 3-4,并提供其他每条记录的唯一 IP 地址。Repeat steps 3-4 for each additional RD Connection Broker, providing each unique IP address for each additional record.

例如,如果两个 RD 连接代理虚拟机的 IP 地址分别是 10.0.0.8 和 10.0.0.9,请创建以下两条 DNS 主机记录:For example, if the IP addresses for the two RD Connection Broker virtual machines are 10.0.0.8 and 10.0.0.9, you would create two DNS host records:

  • 主机名:hacb.contoso.com,IP 地址:10.0.0.8Host name: hacb.contoso.com , IP address: 10.0.0.8
  • 主机名:hacb.contoso.com,IP 地址:10.0.0.9Host name: hacb.contoso.com , IP address: 10.0.0.9

步骤 3:对连接代理进行高可用性配置Step 3: Configure the Connection Brokers for high availability

  1. 将新的 RD 连接代理服务器添加到服务器管理器:Add the new RD Connection Broker server to Server Manager:
    1. 在服务器管理器中,单击“管理”>“添加服务器”。 In Server Manager, click Manage > Add Servers.
    2. 单击“立即查找” 。Click Find Now.
    3. 单击新建的 RD 连接代理服务器(例如 Contoso-Cb2),然后单击“确定”。 Click the newly created RD Connection Broker server (for example, Contoso-Cb2) and click OK.
  2. 对 RD 连接代理进行高可用性配置:Configure high availability for the RD Connection Broker:
    1. 在服务器管理器中,单击“远程桌面服务”>“概述”。 In Server Manager, click Remote Desktop Services > Overview.
    2. 右键单击“RD 连接代理”,然后单击“配置高可用性”。 Right-click RD Connection Broker, and then click Configure High Availability.
    3. 完成向导的每个页面,直到进入“配置类型”部分。Page through the wizard until you get to the Configuration type section. 选择“共享数据库服务器”,然后单击“下一步”。 Select Shared database server, and then click Next.
    4. 输入 RD 连接代理群集的 DNS 名称。Enter the DNS name for the RD Connection Broker cluster.
    5. 输入 SQL 数据库的连接字符串,然后完成向导的每个页面以建立高可用性。Enter the connection string for the SQL DB, and then page through the wizard to establish high availability.
  3. 将新的 RD 连接代理添加到部署Add the new RD Connection Broker to the deployment
    1. 在服务器管理器中,单击“远程桌面服务”>“概述”。 In Server Manager, click Remote Desktop Services > Overview.
    2. 右键单击“RD 连接代理”,然后单击“添加 RD 连接代理服务器”。 Right-click the RD Connection Broker, and then click Add RD Connection Broker Server.
    3. 完成向导的每个页面,直到进入“服务器选择”,然后选择新建的 RD 连接代理服务器(例如 Contoso-CB2)。Page through wizard until you get to Server Selection, then select the newly created RD Connection Broker server (for example, Contoso-CB2).
    4. 完成向导并接受默认值。Complete the wizard, accepting the default values.
  4. 在 RD 连接代理服务器和客户端上配置受信任的证书。Configure trusted certificates on RD Connection Broker servers and clients.