简体   繁体   English

如何关闭 azure 中的一个应用服务实例

[英]How to shutdown one instance of an app service in azure

I have deployd an Asp.Net MVC application to an app service in azure and scaled it out to 2 instances.我已将 Asp.Net MVC 应用程序部署到 azure 中的应用程序服务并将其扩展到 2 个实例。

Sometimes I need to restart an instance, but I only find a way to restart the whole web app.有时我需要重启一个实例,但我只是想办法重启整个 web 应用程序。 Is there a way to restart one instance only?有没有办法只重启一个实例? Even removing the instance and then creating a new one would work for me.即使删除实例然后创建一个新实例也对我有用。

There is no super clean way to do this, but it is still possible to achieve with the following steps:没有超级干净的方法可以做到这一点,但仍然可以通过以下步骤实现:

  • Go to the Web App in the portal转到门户中的 Web 应用程序
  • Choose Process Explorer from Tools menu从工具菜单中选择进程资源管理器
  • You'll see processes for all instances.您将看到所有实例的进程。 You can right click on specific w3wp's and kill them, which effectively restarts the site.您可以右键单击特定的 w3wp 并杀死它们,这会有效地重新启动站点。 You don't have to kill the Kudu process (the one with the K icon) if you only want to restart the site.如果您只想重新启动站点,则不必终止 Kudu 进程(带有 K 图标的进程)。 For WebJobs, kill Kudu as well.对于 WebJobs,也要杀死 Kudu。

You can now restart an instance of an App Service Plan from the App Service Plans - Reboot Worker page in the Azure docs.您现在可以从 Azure 文档中的App Service Plans - Reboot Worker页面重新启动 App Service Plan 的实例。 You can restart the instance directly from that page using the 'Try it' feature.您可以使用“试用”功能直接从该页面重新启动实例。

  • Visit the Reboot Worker page访问Reboot Worker页面
  • Login using an account from the Azure tenant containing the App Service Plan使用包含应用服务计划的 Azure 租户的帐户登录
  • Click 'Try it'点击“试试看”
  • In the right hand pane enter the Name of the App Service plan and the resource group which contains the plan在右侧窗格中输入应用服务计划的名称和包含该计划的资源组
  • Select the Azure subscription which contains the App Service plan Select 包含应用服务计划的 Azure 订阅
  • Enter the name of the work machine (instance) you wish to restart.输入要重启的工作机器(实例)的名称。 This value typically starts with RD and may be found using the metric and diagnostic tools for the Web App in the Azure Portal.该值通常以 RD 开头,可以使用 Azure 门户中 Web 应用程序的指标和诊断工具找到。
  • Click the green Run button at the below the request preview.单击请求预览下方的绿色运行按钮。

If you are using App Services then, unfortunately, this is not possible.如果您使用的是应用服务,那么很遗憾,这是不可能的。 You can only update the no.您只能更新编号。 of instances.的实例。

But as an alternative, you can decrease the number of instances and then increase back again.但作为替代方案,您可以减少实例数,然后再次增加。 Or if you want more granular control, for any reason, then you can deploy the web app in IaaS Virtual Machine workloads and setup instances manually.或者,如果您出于任何原因想要更精细的控制,那么您可以在 IaaS 虚拟机工作负载中部署 Web 应用程序并手动设置实例。

At the time of this posting, there is a Health Check (Preview) feature mentioned in the Azure Portal under the "Diagnose and solve problems -> Best Practices" blade for an App Service.在发布本文时,Azure 门户中的“诊断和解决问题 -> 最佳实践”边栏选项卡中提到了应用服务的运行状况检查(预览)功能。

在此处输入图片说明

Health Check feature automatically removes a faulty instance from rotation, thus improving availability.健康检查功能会自动从轮换中删除故障实例,从而提高可用性。 This feature will ping the specified health check path on all instances of your webapp every 2 minutes.此功能将每 2 分钟在您的 web 应用程序的所有实例上 ping 指定的运行状况检查路径。 If an instance does not respond within 10 minutes (5 pings), the instance is determined to be unhealthy and our service will stop routing requests to it.如果实例在 10 分钟(5 次 ping)内未响应,则确定该实例运行状况不佳,我们的服务将停止向其路由请求。 It is highly recommended for production apps to utilize this feature and minimize any potential downtime caused due to a faulty instance.强烈建议生产应用程序使用此功能,并最大限度地减少因故障实例导致的任何潜在停机时间。 Note : Health Check feature only works for applications that are hosted on more than one instance.注意:健康检查功能仅适用于托管在多个实例上的应用程序。 For more information check the documentation below.有关更多信息,请查看下面的文档。

你可以使用“高级应用程序重启”重启单个实例,你可以在 Azure 门户中应用服务的诊断工具下找到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 azure 应用程序服务,一段时间后没有暴露端口的容器关闭 - azure app service, container without exposed port shutdown after a while 如何修复 Azure 应用程序服务无法加载 DLL 'libwkhtmltox' 或其依赖项之一 - How to fix Azure app service unable to load DLL 'libwkhtmltox' or one of its dependencies 如何从github部署到Azure应用服务 - How to Deploy from github to Azure App Service 如何从 Azure 容器应用服务使用 Azure ACR 进行身份验证 - How to authenticate with Azure ACR from Azure container app service 如何从 Azure 管道中的 Azure 应用服务获取价值 - How to get value from Azure App Service from Azure pipeline 如何从 Azure 服务应用计划中删除/断开 Azure .NET? - How to remove/disconnect an Azure VNET from an Azure Service App Plan? 如何使用私有 Azure Container Registry 创建一个 Azure APP Service? - How to create a Azure APP Service with a private Azure Container Registry? 如何找到一个Azure App服务的cloud_RoleInstance web app - How to find the cloud_RoleInstance of an Azure App service web app 如何提交Azure App Service Quota增加支持请求? - How to submit Azure App Service Quota increase in support request? 如何使用 cdktf 的 Azure Container Registry 部署 App Service - How to deploy App Service with Azure Container Registry by cdktf
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM