适用于 Linux VM 的 Azure 示例基础结构演练Example Azure infrastructure walkthrough for Linux VMs

本文逐步讲述如何构建示例应用程序基础结构。This article walks through building out an example application infrastructure. 我们详细介绍如何设计简单在线商店的基础结构,此在线商店可将关于命名约定、可用性集、虚拟网络及负载均衡器的所有准则和决策聚集在一起;以及如何实际部署你的虚拟机 (VM)。We detail designing an infrastructure for a simple on-line store that brings together all the guidelines and decisions around naming conventions, availability sets, virtual networks and load balancers, and actually deploying your virtual machines (VMs).

示例工作负荷Example workload

Adventure Works Cycles 想要在 Azure 中生成一个在线商店应用程序,该应用程序包含:Adventure Works Cycles wants to build an on-line store application in Azure that consists of:

  • 两个在 Web 层中运行客户端前端的 nginx 服务器Two nginx servers running the client front-end in a web tier
  • 两个在应用程序层中处理数据和订单的 nginx 服务器Two nginx servers processing data and orders in an application tier
  • 包含在分片群集中的两个 MongoDB 服务器,用于在数据库层中存储产品数据和订单Two MongoDB servers part of a sharded cluster for storing product data and orders in a database tier
  • 位于身份验证层中、用于客户帐户和供应商的两个 Active Directory 域控制器Two Active Directory domain controllers for customer accounts and suppliers in an authentication tier
  • 所有服务器皆位于两个子网中:All the servers are located in two subnets:
    • Web 服务器位于前端子网中a front-end subnet for the web servers
    • 应用程序服务器、MongoDB 群集和域控制器位于后端子网中a back-end subnet for the application servers, MongoDB cluster, and domain controllers

不同应用程序基础结构层的关系图

当客户浏览在线商店时,传入的安全 Web 流量必须在 Web 服务器之间进行负载均衡。Incoming secure web traffic must be load-balanced among the web servers as customers browse the on-line store. 来自 Web 服务器的 HTTP 请求形式的订单处理流量必须在应用程序服务器之间进行负载均衡。Order processing traffic in the form of HTTP requests from the web servers must be load-balanced among the application servers. 此外,基础结构必须设计为具有高可用性。Additionally, the infrastructure must be designed for high availability.

生成的设计必须引入:The resulting design must incorporate:

  • Azure 订阅和帐户An Azure subscription and account
  • 单个资源组A single resource group
  • Azure 托管磁盘Azure Managed Disks
  • 包含两个子网的虚拟网络A virtual network with two subnets
  • 具有类似角色的 VM 的可用性集Availability sets for the VMs with a similar role
  • 虚拟机Virtual machines

以上各项都会遵循以下命名约定:All the above follow these naming conventions:

  • Adventure Works Cycles 使用 [IT 工作负荷]-[位置]-[Azure 资源] 作为前缀Adventure Works Cycles uses [IT workload]-[location]-[Azure resource] as a prefix
    • 在本示例中,IT 工作负荷名为 azos(Azure On-line Store,Azure 在线商店),位置为 che(China East 2,中国东部 2)For this example, "azos" (Azure On-line Store) is the IT workload name and "use" (China East 2) is the location
  • 虚拟网络使用 AZOS-CHE-VN[number]Virtual networks use AZOS-CHE-VN[number]
  • 可用性集使用 azos-che-as-[role]Availability sets use azos-che-as-[role]
  • 虚拟机名称使用 azos-che-vm-[vmname]Virtual machine names use azos-che-vm-[vmname]

Azure 订阅和帐户Azure subscriptions and accounts

Adventure Works Cycles 使用名为 Adventure Works 企业订阅的企业订阅为此 IT 工作负荷提供计费。Adventure Works Cycles is using their Enterprise subscription, named Adventure Works Enterprise Subscription, to provide billing for this IT workload.

存储Storage

Adventure Works Cycles 确定其应使用 Azure 托管磁盘。Adventure Works Cycles determined that they should use Azure Managed Disks. 创建 VM 时,会使用两种存储可用的存储层:When creating VMs, both storage available storage tiers are used:

  • 标准存储用于 Web 服务器、应用程序服务器和域控制器及其数据磁盘。Standard storage for the web servers, application servers, and domain controllers and their data disks.
  • 用于 MongoDB 分片群集服务器及其数据磁盘的高级存储Premium storage for the MongoDB sharded cluster servers and their data disks.

虚拟网络和子网Virtual network and subnets

由于虚拟网络不需要持续连接到 Adventure Work Cycles 本地网络,因此,他们决定选择仅限云的虚拟网络。Because the virtual network does not need ongoing connectivity to the Adventure Work Cycles on-premises network, they decided on a cloud-only virtual network.

他们通过 Azure 门户使用以下设置创建了仅限云的虚拟网络:They created a cloud-only virtual network with the following settings using the Azure portal:

  • 姓名:AZOS-CHE-VN01Name: AZOS-CHE-VN01
  • 位置:中国东部 2Location: China East 2
  • 虚拟网络地址空间:10.0.0.0/8Virtual network address space: 10.0.0.0/8
  • 第一个子网:First subnet:
    • 姓名:FrontEndName: FrontEnd
    • 地址空间:10.0.1.0/24Address space: 10.0.1.0/24
  • 第二个子网:Second subnet:
    • 姓名:BackEndName: BackEnd
    • 地址空间:10.0.2.0/24Address space: 10.0.2.0/24

可用性集Availability sets

为了维护其在线商店的所有四个层的高可用性,Adventure Works Cycles 决定使用四个可用性集:To maintain high availability of all four tiers of their on-line store, Adventure Works Cycles decided on four availability sets:

  • azos-che-as-web 用于 Web 服务器azos-che-as-web for the web servers
  • azos-che-as-app 用于应用程序服务器azos-che-as-app for the application servers
  • azos-che-as-db 用于 MongoDB 分片群集中的服务器azos-che-as-db for the servers in the MongoDB sharded cluster
  • azos-che-as-dc 用于域控制器azos-che-as-dc for the domain controllers

虚拟机Virtual machines

Adventure Works Cycles 决定为其 Azure VM 使用以下名称:Adventure Works Cycles decided on the following names for their Azure VMs:

  • azos-che-vm-web01 用于第一个 Web 服务器azos-che-vm-web01 for the first web server
  • azos-che-vm-web02 用于第二个 Web 服务器azos-che-vm-web02 for the second web server
  • azos-che-vm-app01 用于第一个应用程序服务器azos-che-vm-app01 for the first application server
  • azos-che-vm-app02 用于第二个应用程序服务器azos-che-vm-app02 for the second application server
  • azos-che-vm-db01 用于群集中的第一个 MongoDB 服务器azos-che-vm-db01 for the first MongoDB server in the cluster
  • azos-che-vm-db02 用于群集中的第二个 MongoDB 服务器azos-che-vm-db02 for the second MongoDB server in the cluster
  • azos-che-vm-dc01 用于第一个域控制器azos-che-vm-dc01 for the first domain controller
  • azos-che-vm-dc02 用于第二个域控制器azos-che-vm-dc02 for the second domain controller

这是生成的配置。Here is the resulting configuration.

在 Azure 中部署的最终应用程序基础结构

此配置引入以下项:This configuration incorporates:

  • 包含两个子网(FrontEnd 和 BackEnd)的仅限云虚拟网络A cloud-only virtual network with two subnets (FrontEnd and BackEnd)
  • 同时使用标准磁盘和高级磁盘的 Azure 托管磁盘Azure Managed Disks using both Standard and Premium disks
  • 四个可用性集,每个在线商店层一个Four availability sets, one for each tier of the on-line store
  • 四个层中的虚拟机The virtual machines for the four tiers
  • 用于从 Internet 到 Web 服务器的基于 HTTPS 的 Web 流量的外部负载均衡集An external load balanced set for HTTPS-based web traffic from the Internet to the web servers
  • 用于从 Web 服务器到应用程序服务器的未加密 Web 流量的内部负载均衡集An internal load balanced set for unencrypted web traffic from the web servers to the application servers
  • 单个资源组A single resource group