gpt4 book ai didi

azure - 如何按计划扩大或缩小 Azure 应用服务实例大小?

转载 作者:行者123 更新时间:2023-12-04 13:26:35 25 4
gpt4 key购买 nike

关于Azure App Service的自动缩放,我只找到以下内容。

Scale a web app in Azure App Service

这仅允许扩展到更多或更少的实例。它不允许扩展到更大和更小的实例。

我想按计划安排小、中、大之间的应用服务实例大小。有没有 API 可以让我做到这一点?

非常感谢。

最佳答案

由于缺乏简单的解决方案,我创建了一个一键部署来执行您所要求的操作。

https://github.com/jraps20/jrap-AzureVerticalScaling

概述

我的方法使用 Azure 自动化 Runbook。通过一键部署方法,您可以在几分钟内完全启动并运行。两个互补的 Runbook(ScaleAppServicePlansUp 和 ScaleAppServicePlansDown)协同工作来存储、读取和修改您选择的任何应用服务计划。这些 Runbook 的主要目标是非生产环境。

不幸的是,代码太长,无法包含在这个答案中(所以是的,这主要是一个仅链接的答案)。

伪代码

缩小规模

Iterate across all Resource Groups (or pass in specific one)
Iterate across all App Service Plans (or pass in specific one)
Iterate across all App Services (identify Tier-specific settings)

During iteration, the current App Service Plan Service Tier is stored in Azure Automation Variables (3 distinct variables for each App Service Plan)

Within each App Service Plan, each App Service is iterated to identify tier-specific settings. Some of these settings include: AlwaysOn, Use32BitWorkerProcess, and ClientCertEnabled. All current settings are stored in Azure Automation Variables.

All App Service Plans are then scaled down to the FREE tier.

扩大规模

Iterate across all Resource Groups (or pass in specific one)
Iterate across all App Service Plans (or pass in specific one)
Iterate across all App Services (identify Tier-specific settings)

During iteration, the original App Service Plan Service Tier is retrieved from Azure Automation Variables (3 distinct variables for each App Service Plan)

Within each App Service Plan, each App Service is iterated and any previously stored tier-specific settings are retrieved.

All App Service Plans are then scaled up to their original tier.
All App Services with tier-specific settings are reapplied to their original values.

其他资源

免责声明

我意识到Sam Spoerles technique 完成工作后。与他的方法相比,我的方法的优点如下:

关于azure - 如何按计划扩大或缩小 Azure 应用服务实例大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34082418/

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