gpt4 book ai didi

powershell - 当 AppService 运行/扩展到 2 个以上实例时的 Azure 部署

转载 作者:行者123 更新时间:2023-12-04 18:34:14 24 4
gpt4 key购买 nike

我正在为我们的项目开发一项功能,该功能将持续部署到生产中。在开发过程中我发现如果使用部署槽:

暂存交换到生产环境在运行多个实例的 Web 角色中(也称为横向扩展模式),交换 Stage->Prod 仅发生在 1 个实例上。

所以问题是我可能会运行陈旧/错误的代码。到目前为止我发现的唯一方法:1. 缩小规模2.交换3.扩大规模

该解决方案效率不高。有没有办法热交换Web角色的所有实例?

最佳答案

我们按照 Microsoft 指南进行部署实现。
https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-staged-publishing

部署后结果实例计数将持续存在

要创建 Staging slot,-Slot 是 Staging

New-AzureRmWebAppSlot -ResourceGroupName [resource group name] -Name [app name] -Slot [deployment slot name] -AppServicePlan [app service plan name]

交换插槽

$ParametersObject = @{targetSlot  = "[slot name – e.g. “production”]"} 
Invoke-AzureRmResourceAction -ResourceGroupName [resource group name] -ResourceType Microsoft.Web/sites/slots -ResourceName [app name]/[slot name] -Action slotsswap -Parameters $ParametersObject -ApiVersion 2015-07-01

请注意,您可能需要部署服务主体才能与资源管理器交互

https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal

更新于 4/19 -我发现可能存在其他与持久性相关的问题,这些问题会在部署后扰乱应用程序,这里有两个示例可能会有所帮助,但问题主要是特定于应用程序的

  1. Disabling ARR’s Instance Affinity in Windows Azure Web Sites

  2. Azure Websites and stateful webApp

关于powershell - 当 AppService 运行/扩展到 2 个以上实例时的 Azure 部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41050840/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com