在 Azure Stack Hub 上的 Azure App Service 中新增背景工作角色和基礎結構Add workers and infrastructure in Azure App Service on Azure Stack Hub

此文件提供如何在 Azure Stack Hub 上的 Azure App Service 中調整基礎結構和背景工作角色的相關指示。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 環境」的 RAM 未超過 96 GB,您可能很難增加額外的容量。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 App Service 支援免費和共用背景工作角色層。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 App Service 安裝部署了哪個項目,您可以檢閱 Azure Stack Hub 上的 App Service 概觀中的其他資訊。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 App Service 會使用虛擬機器擴展集部署所有角色,實質上利用此工作負載的縮放功能。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. 因此,所有背景工作層的縮放是透過 App Service 管理員完成。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.
    Login-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. 在 App Service 系統管理中監視新角色執行個體的狀態。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. 瀏覽至 [App Service]。Browse to App Services.

    Azure Stack Hub 系統管理員入口網站中的 App Service

  3. 按一下 [角色]。Click Roles. 您可以在這裡看到所有已部署之 App Service 角色的明細。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 系統管理員入口網站中的 ScaleSet App Service 角色

  5. 按一下 [調整大小],選取您想要調整為多少執行個體數,然後按一下 [儲存]。Click Scaling, select the number of instances you want to scale to, and then click Save.

    在 Azure Stack Hub 系統管理員入口網站中設定要在 App Service 角色中調整的執行個體

  6. Azure Stack Hub 上的 Azure App Service 現在將新增額外的 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 系統管理員入口網站中新 App Service 方案的定價層

注意

若要擴增管理、前端或發行者角色,請遵循相同的步驟來選取適當的角色類型。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