简体   繁体   中英

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.

Sometimes I need to restart an instance, but I only find a way to restart the whole web app. 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
  • 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. You don't have to kill the Kudu process (the one with the K icon) if you only want to restart the site. For WebJobs, kill Kudu as well.

You can now restart an instance of an App Service Plan from the App Service Plans - Reboot Worker page in the Azure docs. You can restart the instance directly from that page using the 'Try it' feature.

  • Visit the Reboot Worker page
  • Login using an account from the Azure tenant containing the App Service Plan
  • 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
  • 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.
  • 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.

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.

在此处输入图片说明

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. 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. 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 门户中应用服务的诊断工具下找到它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM