无法在Azure Web应用程序中明智地查看日志实例(Apache Tomcat 8)-横向扩展 [英] Unable to view logs instance wise in azure web apps (Apache Tomcat 8) - scale out

查看:99
本文介绍了无法在Azure Web应用程序中明智地查看日志实例(Apache Tomcat 8)-横向扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为Web应用程序的Apache tomcat 8,可横向扩展-如何为多个实例存储日志?我无法查看日志实例.

如何访问每个实例的文件限制?

示例:

我将Apache tomcat 8作为应用程序服务扩展到了2.因此,有两个实例正在运行.

如何访问两个实例的日志.

请您尽快看看并回复我,这太紧急了.

注意:如果我扩展到3,则3个实例正在运行.如果我浏览它并在网络上做某事,它将写入相同的应用程序日志3次.

解决方案

如何在Azure Web App中按实例分隔Tomcat日志.

详细答案:为了对此有更好的了解,当您在App Service中创建应用程序时,会将其放入App Service计划中.当应用程序运行时,它将在应用程序服务计划中配置的所有VM实例上运行.
主目录包含应用程序的内容,应用程序代码可以对其进行写入.如果一个应用程序在多个实例上运行, 主目录 在所有实例之间共享,以便所有 实例看到相同的目录.因此,例如,如果应用程序将上传的文件保存到主目录,则这些文件可立即用于所有实例.

您可以找到随时运行的实例数量并连接到特定实例如中所述使用Kudu .

参考 有关该主题的更多详细信息.

此外,Azure应用服务允许您通过动态添加Web自动缩放Web应用服务器实例来处理到您的Web应用的流量. Azure应用程序服务使用应用程序 请求路由IIS扩展,以在服务内容的活动实例之间分配连接的用户.

如果保持会话亲和力并不重要,并且您希望更好的负载平衡,则可以禁用会话关联性Cookie.推荐这个博客 了解更多详细信息. ;

此外,Azure App Service可以处理3种文件:

    永久文件
  • 临时文件
  • 机器级只读文件

D:\ home \ site \ wwwroot是您的网站源代码所在的位置.

永久文件: 临时文件: 机器级只读文件: Azure App Service能够访问Windows等标准位置 %ProgramFiles%和%windir%,但不能修改.可以在 此处 .

请参阅 解决方案

Short answer: Yes, all the instances are shared. See, How to Separate Tomcat Logging Per Instance in Azure Web App.

Detailed answer: To provide a better insight on this, when you create an app in App Service, it is put into an App Service plan. When the app runs, it runs on all the VM instances configured in the App Service plan. The home directory contains an app's content, and application code can write to it. If an app runs on multiple instances, the home directory is shared among all instances so that all instances see the same directory. So, for example, if an app saves uploaded files to the home directory, those files are immediately available to all instances.

You can find the number of instances running at any time and connect to a specific instance using Kudu as mentioned in this blog

Refer Best practices for Autoscale for more details on this topic.

Further, Azure app service allows you to auto scale your web app by dynamically adding web server instances to handle the traffic to your web app. Azure app service uses Application Request Routing IIS Extension to distribute your connecting users between your active instances serving up the content. 

If maintaining session affinity is not important and you want better load balancing, you could disable session affinity cookie. Refer this blog Disable Session affinity cookie (ARR cookie) for Azure web apps for more details. 

Additionally, there are 3 kinds of files that an Azure App Service can deal with:

  • Persisted Files
  • Temporary Files
  • Machine Level read-only files

D:\home\site\wwwroot is the location where you site source code exists. 

Persisted Files: These files are rooted in the D:\home path.  The contents of these files are shared between all the multiple instances of your App Services.  Information about the file structure under the D:\home directory can be found here (file structure on Azure)

Temporary Files: These files, stored in the D:\Local are accessible only from the individual instance of the App Service Plan.

Machine Level read-only files: The Azure App Service is able to access standard Windows locations like %ProgramFiles% and %windir% but cannot be modified.  Some more information about this topic can be found here.

Refer Understanding the Azure App Service file system for more details on this topic.


这篇关于无法在Azure Web应用程序中明智地查看日志实例(Apache Tomcat 8)-横向扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆