远程连接到虚拟机规模集实例或群集节点Remote connect to a virtual machine scale set instance or a cluster node

在 Azure 中运行的 Service Fabric 群集中,定义的每个群集节点类型都会设置虚拟机单独规模In a Service Fabric cluster running in Azure, each cluster node type that you define sets up a virtual machine separate scale. 可以远程连接到特定规模集实例(群集节点)。You can remote connect to specific scale set instances (cluster nodes). 不同于单实例 VM,规模集实例本身没有虚拟 IP 地址。Unlike single-instance VMs, scale set instances don't have their own virtual IP addresses. 可能很难找到可用来远程连接到特定实例的 IP 地址和端口。This can be challenging when you are looking for an IP address and port that you can use to remotely connect to a specific instance.

若要查找可用于远程连接到特定实例的 IP 地址和端口,请完成以下步骤。To find an IP address and port that you can use to remotely connect to a specific instance, complete the following steps.

  1. 获取远程桌面协议 (RDP) 的入站 NAT 规则。Get the inbound NAT rules for Remote Desktop Protocol (RDP).

    通常,群集中定义的每种节点类型有自己的虚拟 IP 地址和专用的负载均衡器。Typically, each node type defined in your cluster has its own virtual IP address and a dedicated load balancer. 默认情况下,节点类型的负载均衡器以以下格式命名:LB-{节点名称}-{节点类型};例如,LB-mycluster-FrontEnd 。By default, the load balancer for a node type is named with the following format: LB-{cluster-name}-{node-type} ; for example, LB-mycluster-FrontEnd .

    在 Azure 门户中的负载均衡器页上,选择“设置” > “入站 NAT 规则”:On the page for your load balancer in Azure portal, select Settings > Inbound NAT rules :

    Azure 门户中负载均衡器页的屏幕截图。在左侧菜单的“设置”下选择了“入站 NAT 规则”。

    以下屏幕截图显示名为 FrontEnd 的节点类型的入站 NAT 规则:The following screenshot shows the inbound NAT rules for a node type named FrontEnd:

    显示负载均衡器的入站 NAT 规则的屏幕截图。其中列出了每个规则的“名称”、“IP 版本”、“目标”以及“目标和服务”。

    对于每个节点,IP 地址显示在“DESTINATION”列中,“TARGET”列提供规模集实例,“SERVICE”列提供端口号 。For each node, the IP address appears in the DESTINATION column, the TARGET column gives the scale set instance, and the SERVICE column provides the port number. 对于远程连接,从端口 3389 开始按升序将端口分配到每个节点。For remote connection, ports are allocated to each node in ascending order beginning with port 3389.

    还可以在群集资源管理器模板的 Microsoft.Network/loadBalancers 部分找到入站 NAT 规则。You can also find the Inbound NAT rules in the Microsoft.Network/loadBalancers section of the Resource Manager template for your cluster.

  2. 若要确认节点的入站端口到目标端口映射,可以单击其规则并查看“目标端口”值 。To confirm the inbound port to target port mapping for a node, you can click its rule and look at the Target port value. 以下屏幕截图显示上一步中“FrontEnd (实例 1)”节点的入站 NAT 规则 。The following screenshot shows the inbound NAT rule for the FrontEnd (Instance 1) node in the previous step. 请注意,虽然(入站)端口号为 3390,但是目标端口映射到端口 3389,即目标上 RDP 服务的端口。Notice that, although the (inbound) port number is 3390, the target port is mapped to port 3389, the port for the RDP service on the target.

    目标端口映射

    默认情况下,对于 Windows 群集,目标端口为端口 3389,它映射到目标节点上的 RDP 服务。By default, for Windows clusters, the target port is port 3389, which maps to the RDP service on the target node. 对于 Linux 群集,目标端口为端口 22,它映射到安全外壳 (SSH) 服务。For Linux clusters, the target port is port 22, which maps to the Secure Shell (SSH) service.

  3. 远程连接到特定节点(规模集实例)。Remotely connect to the specific node (scale set instance). 可以使用创建群集时设置的用户名和密码,也可使用已配置的其他任意凭据。You can use the user name and password that you set when you created the cluster or any other credentials you have configured.

    以下屏幕截图显示在 Windows 群集中使用远程桌面连接连接到“FrontEnd (实例 1)”节点 :The following screenshot shows using Remote Desktop Connection to connect to the FrontEnd (Instance 1) node in a Windows cluster:

    远程桌面连接

    在 Linux 节点上,可以借助 SSH 进行连接(为简洁起见,下例重复使用相同的 IP 地址和端口):On Linux nodes, you can connect with SSH (the following example reuses the same IP address and port for brevity):

    ssh SomeUser@40.117.156.199 -p 3390
    

有关后续步骤,请阅读以下文章:For next steps, read the following articles: