在 Azure Stack Hub 上的 Azure 应用服务中添加辅助角色和基础结构Add workers and infrastructure in Azure App Service on Azure Stack Hub

本文档说明如何在 Azure Stack Hub 上的 Azure 应用服务中缩放基础结构和辅助角色。This document provides instructions on how to scale infrastructure and worker roles in Azure App Service on Azure Stack Hub. 我们将介绍创建其他辅助角色以支持任何大小的应用所需的所有步骤。We'll cover all the steps necessary for creating additional worker roles to support apps of any size.

备注

如果 Azure Stack Hub 环境没有 96 GB 以上的 RAM,则可能难以添加更多的容量。If your Azure Stack Hub Environment doesn't have more than 96-GB RAM, you may have difficulties adding additional capacity.

Azure Stack Hub 上的 Azure 应用服务默认支持免费的和共享的辅助角色层。Azure App Service on Azure Stack Hub supports free and shared worker tiers by default. 若要添加其他辅助角色层,需添加更多的辅助角色。To add other worker tiers, you need to add more worker roles.

如果不确定 Azure Stack Hub 上的默认 Azure 应用服务安装的部署内容,可以在 Azure Stack Hub 上的应用服务概述中查看更多信息。If you're not sure what was deployed with the default Azure App Service on Azure Stack Hub installation, you can review additional info in the App Service on Azure Stack Hub overview.

基于 Azure Stack Hub 的 Azure 应用服务使用虚拟机规模集来部署所有角色,因此可充分利用此工作负荷的缩放功能。Azure App Service on Azure Stack Hub deploys all roles using Virtual Machine Scale Sets and as such takes advantage of the scaling capabilities of this workload. 因此,辅助角色层的所有缩放都是通过应用服务管理员完成的。Therefore, all scaling of the worker tiers is done via the App Service Admin.

使用 PowerShell 添加更多辅助角色Add additional workers with PowerShell

  1. 在 PowerShell 中设置 Azure Stack Hub 管理环境Set up the Azure Stack Hub admin environment in PowerShell

  2. 使用以下示例来横向扩展规模集。Use this example to scale out the scale set.

    
    ##### Scale out the AppService Role instances ######
    
    # Set context to AzureStack admin.
    Connect-AzAccount -EnvironmentName AzureStackAdmin
    
    ## Name of the Resource group where AppService is deployed.
    $AppServiceResourceGroupName = "AppService.local"
    
    ## Name of the ScaleSet : e.g. FrontEndsScaleSet, ManagementServersScaleSet, PublishersScaleSet , LargeWorkerTierScaleSet,      MediumWorkerTierScaleSet, SmallWorkerTierScaleSet, SharedWorkerTierScaleSet
    $ScaleSetName = "SharedWorkerTierScaleSet"
    
    ## TotalCapacity is sum of the instances needed at the end of operation. 
    ## e.g. if your VMSS has 1 instance(s) currently and you need 1 more the TotalCapacity should be set to 2
    $TotalCapacity = 2  
    
    # Get current scale set
    $vmss = Get-AzVmss -ResourceGroupName $AppServiceResourceGroupName -VMScaleSetName $ScaleSetName
    
    # Set and update the capacity
    $vmss.sku.capacity = $TotalCapacity
    Update-AzVmss -ResourceGroupName $AppServiceResourceGroupName -Name $ScaleSetName -VirtualMachineScaleSet $vmss 
    

    备注

    根据角色类型和实例数目,此步骤可能需要几小时才能完成。This step can take a number of hours to complete depending on the type of role and the number of instances.

  3. 在“应用服务管理”中监视新角色实例的状态。Monitor the status of the new role instances in the App Service administration. 若要检查单个角色实例的状态,请单击列表中的角色类型。To check the status of an individual role instance, click the role type in the list.

使用管理员门户添加更多辅助角色Add additional workers using the administrator portal

  1. 以服务管理员身份登录到 Azure Stack Hub 管理员门户。Sign in to the Azure Stack Hub administrator portal as the service admin.

  2. 浏览到“应用服务”。Browse to App Services.

    Azure Stack Hub 管理员门户中的应用服务

  3. 单击“角色”。Click Roles. 在这里会看到所有已部署的应用服务角色的明细。Here you see the breakdown of all App Service roles deployed.

  4. 右键单击要缩放的类型所在的行,然后单击“ScaleSet”。Right click on the row of the type you want to scale and then click ScaleSet.

    Azure Stack Hub 管理员门户中的规模集应用服务角色

  5. 单击“缩放”,选择要缩放到的实例数,然后单击“保存”。Click Scaling, select the number of instances you want to scale to, and then click Save.

    在 Azure Stack Hub 管理员门户的应用服务角色中设置要缩放到的实例

  6. 基于 Azure Stack Hub 的 Azure 应用服务此时会添加其他 VM,对其进行配置,安装所有必需的软件,并在此过程完成后将其标记为“就绪”。Azure App Service on Azure Stack Hub will now add the additional VMs, configure them, install all the required software, and mark them as ready when this process is complete. 此过程可能需要大约 80 分钟。This process can take approximately 80 minutes.

  7. 可以监视新角色就绪标记操作的进度,只需在“角色”边栏选项卡中查看辅助角色即可。You can monitor the progress of the readiness of the new roles by viewing the workers in the Roles blade.

结果Result

在完全部署并就绪以后,辅助角色即可供用户使用,用户可以将其工作负荷部署到辅助角色上。After they're fully deployed and ready, the workers become available for users to deploy their workload onto them. 以下屏幕截图显示的示例为默认提供的多个定价层。The following screenshot shows an example of the multiple pricing tiers available by default. 如果特定的辅助角色层没有可用的辅助角色,则用于选择相应定价层的选项不可用。If there are no available workers for a particular worker tier, the option to choose the corresponding pricing tier is unavailable.

Azure Stack Hub 管理员门户中的新应用服务计划的定价层

备注

若要扩展管理、前端或发布者角色,请执行相同的步骤来选择适当的角色类型。To scale out Management, Front End, or Publisher roles, follow the same steps selecting the appropriate role type. 控制器不会部署为规模集,因此在安装时应为所有生产部署部署两个控制器。Controllers aren't deployed as Scale Sets and therefore two should be deployed at installation time for all production deployments.

后续步骤Next steps

配置部署源Configure deployment sources