教程:在 Service Fabric 独立群集上部署应用程序Tutorial: Deploy an application on your Service Fabric standalone cluster

Service Fabric 独立群集为你提供选择自己的环境的选项,并创建群集作为 Service Fabric 所采用的“任何 OS、任何云”方法的一部分。Service Fabric standalone clusters offer you the option to choose your own environment and create a cluster as part of the "any OS, any cloud" approach that Service Fabric is taking. 在本教程系列中,将创建一个在 AWS 上托管的独立群集并将应用程序部署到其中。In this tutorial series, you create a standalone cluster hosted on AWS and deploy an application into it.

本教程是一个系列中的第三部分。This tutorial is part three of a series. Service Fabric 独立群集为你提供选择自己的环境的选项,并使用 Service Fabric 创建群集作为“任何 OS、任何云”方法的一部分。Service Fabric standalone clusters offer you the option to choose your own environment and create a cluster as part of our "any OS, any cloud" approach with Service Fabric. 本教程介绍如何创建托管此独立群集所需的 AWS 基础结构。This tutorial shows you how to create the AWS infrastructure necessary to host this standalone cluster.

本文将指导如何进行以下操作:In this article, you'll learn how to:

  • 下载示例应用Download the sample app
  • 部署到群集Deploy to the cluster

必备条件Prerequisites

在开始学习本教程之前:Before you begin this tutorial:

下载投票示例应用程序Download the voting sample application

在命令窗口中,运行以下命令,将示例应用程序存储库克隆到本地计算机。In a command window, run the following command to clone the sample app repository to your local machine.

git clone https://github.com/Azure-Samples/service-fabric-dotnet-quickstart

将应用部署到 Service Fabric 群集Deploy the app to the Service Fabric cluster

下载应用程序后,可以直接从 Visual Studio 将其部署到群集中。Once the application is downloaded, you can deploy it to a cluster directly from Visual Studio.

  1. 打开 Visual StudioOpen Visual Studio

  2. 选择“文件” > “打开”Select File > Open

  3. 导航到将 git 存储库克隆到的文件夹,然后选择 Voting.slnNavigate to the folder you cloned the git repository to, and select Voting.sln

  4. 在解决方案资源管理器中右键单击 Voting 应用程序项目,选择“发布” Right-click on the Voting application project in the Solution Explorer and choose Publish

  5. 选择 连接终结点 的下拉列表,并输入群集中某个节点的公共 DNS 名称。Select the dropdown for the Connection Endpoint and enter the public DNS Name of one of the nodes in your cluster. 例如,ec2-34-215-183-77.china-north-2.compute.amazonaws.com:19000For example, ec2-34-215-183-77.china-north-2.compute.amazonaws.com:19000. 在 Azure 中,不会自动提供完全限定的域名 (FQDN),但可以在“VM 概述”页中轻松设置In Azure, a fully qualified domain name (FQDN) is not given automatically, but can easily be set in VM Overview page.

  6. 打开你喜欢使用的浏览器并键入群集地址(连接终结点,此应用部署在端口 8080 上 - 例如,ec2-34-215-183-77.china-north-2.compute.amazonaws.com:8080)。Open you preferred browser and type in the cluster address (the connection endpoint, this app deploys on port 8080 - for example, ec2-34-215-183-77.china-north-2.compute.amazonaws.com:8080).

    来自群集的 API 响应

后续步骤Next steps

本文介绍了如何将应用程序部署到群集:In this article, you learned how to deploy an application to your cluster:

  • 下载示例应用Download the sample app
  • 部署到群集Deploy to the cluster

转到本系列教程的第四部分来清理群集。Advance to part four of the series to clean up your cluster.