【应用服务 App Service】App Service For Linux 中如何挂载一个共享文件夹呢? Mount Azure Storage Account File Share

简介: 【应用服务 App Service】App Service For Linux 中如何挂载一个共享文件夹呢? Mount Azure Storage Account File Share

问题描述

使用Linux作为服务器运行Web App时,如何将 Storage Account 作为本地共享装载到 App Service for  Linux / Container 中的应用呢?

问题解答

根据官网介绍, App Service For Linux / Container 是可以通过配置完成Mount Azure Storage Account的blob或者是File Share 到Linux环境中的。 它主要的优势有以下四点:

  1. 为App Service 应用配置永久性存储,并单独管理存储。
  2. 使静态内容(如视频和图像)可随时用于App Service 应用。
  3. 将应用程序日志文件写入 Azure 文件共享,或将较旧的应用程序日志存档到 Azure 文件共享。
  4. 跨多个应用或与其他 Azure 服务共享内容。

操作步骤可以详细参考:以本地共享(容器)形式装载 Azure 存储 - Azure App Service | Microsoft Docs

添加 Azure Storage Mount 的内容说明如下:

名称(Name) :装载配置的名称。 不允许空格。

配置选项 (Configuration options): 如果存储帐户未使用服务终结点或专用终结点,则选择“基本”。 否则,选择“高级”。

存储帐户 (Storage accounts):Azure 存储帐户。

存储类型 (Storage type):根据要装载的存储选择类型。 Azure Blob 仅支持只读访问。

存储容器 / 共享名(Storage container / Share name) :要装载的文件共享或 Blob 容器。

访问密钥(仅高级)(Access Key) :存储帐户的访问密钥。

装载路径(Mount path) :要装载到 Azure 存储的 Linux 容器中的目录。 不要使用 / 或 /home。

 

问题验证

在App Service门户中,进入SSH页面( https://<yourappservicename>.scm.chinacloudsites.cn/webssh/host ),执行 df –h 显示查看File Share是否Mount成功。

 

在/appcontent目录中新建文件test1.txt,然后在Storage Account中查看文件是否存在

 

 

也可以在SSH中通过 tcpping 来查看App Service Storage Account之间的网络连通性

tcpping <Storageaccount>.file.core.chinacloudapi.cn

 

附录一:容器app service 如何添加启动参数 --privileged

可以在App Service的Configuration 配置页面中对启动命令一项中根据需求进行设置。如设置 –privileged = true

设置保存后,通过kudu( https://<your app service name>.scm.chinacloudsites.cn/ )站点进入bash页面,查看Logfiles中的日志文件。可以查看到docker run指令中已经包含了 –privileged=ture 参数。

 

 

 

参考文档

 

将 Azure 存储作为本地共享装载到应用服务中的容器应用https://docs.microsoft.com/zh-cn/azure/app-service/configure-connect-to-azure-storage?tabs=portal&pivots=container-linux#mount-storage-to-linux-container

Linux df command - displays number of free disk blocks and free files : https://docs.oracle.com/cd/E23823_01/html/816-5166/df-1m.html#REFMAN1Mdf-1m

-h

Like -k, except that sizes are in a more human readable format. The output consists of one line of information for each specified file system. This information includes the file system name, the total space allocated in the file system, the amount of space allocated to existing files, the total amount of space available for the creation of new files by unprivileged users, and the percentage of normally available space that is currently allocated to all files on the file system. All sizes are scaled to a human readable format, for example, 14K, 234M, 2.7G, or 3.0T. Scaling is done by repetitively dividing by 1024.

This option overrides the -b, -e, -g, -k, -n, -t, and -V options. This option only works on mounted filesystems and can not be used together with -o option.

-k

Prints the allocation in kbytes. The output consists of one line of information for each specified file system. This information includes the file system name, the total space allocated in the file system, the amount of space allocated to existing files, the total amount of space available for the creation of new files by unprivileged users, and the percentage of normally available space that is currently allocated to all files on the file system. This option overrides the -b, -e, -n, and -t options.

-l

Reports on local file systems only. This option is used only for mounted file systems. It can not be used with the -o option.

 

 

相关文章
|
1月前
|
应用服务中间件 Linux nginx
【Azure App Service】基于Linux创建的App Service是否可以主动升级内置的Nginx版本呢?
基于Linux创建的App Service是否可以主动升级内置的Nginx版本呢?Web App Linux 默认使用的 Nginx 版本是由平台预定义的,无法更改这个版本。
139 77
|
2月前
|
C#
【Azure Function】Function App出现System.IO.FileNotFoundException异常
Exception while executing function: xxxxxxx,The type initializer for 'xxxxxx.Storage.Adls2.StoreDataLakeGen2Reading' threw an exception. Could not load file or assembly 'Microsoft.Extensions.Configuration, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the
117 64
|
2月前
|
监控 关系型数据库 MySQL
|
5天前
|
存储 安全 开发工具
【Azure Storage Account】利用App Service作为反向代理后续 ---- 隐藏 SAS Token
本文介绍了如何通过App Service作为反向代理,将SAS Token追加到请求URL中,以避免直接在代码或配置文件中存储SAS Token带来的安全性和维护问题。具体步骤包括修改App Service的web.config Rewrite规则,将SAS Token添加到转发的URL中;并在.NET SDK中仅使用不包含SAS Token的Uri进行Blob操作。这样既提高了安全性,也简化了SAS Token的管理。
36 16
|
14天前
|
Web App开发 网络协议 网络安全
【Azure App Service】App Service 是否支持HostName SNI 证书?
App Service 支持 HostName SNI 证书。为自定义域名添加 SSL 证书时,可以选择 SNI SSL 和基于 IP 的 SSL。SNI SSL 允许多个 TLS/SSL 证书保护同一 IP 地址上的多个域,适用于大多数现代浏览器。配置方法是在添加自定义域名后,点击 Add binding 配置 SNI SSL。参考文档:[Azure 官方文档](https://docs.azure.cn/zh-cn/app-service/configure-ssl-bindings#add-the-binding)。
|
1月前
|
JavaScript API
【Azure Function】Function App门户上的Test/Run返回错误:Failed to fetch
Running your function in portal requires the app to explicitly accept requests from https://portal.azure.cn. This is known as cross-origin resource sharing (CORS).Configure CORS to add https://portal.azure.cn to allowed origins.
|
2月前
|
Windows
【Azure App Service】对App Service中CPU指标数据中系统占用部分(System CPU)的解释
在Azure App Service中,CPU占比可在App Service Plan级别查看整个实例的资源使用情况。具体应用中仅能查看CPU时间,需通过公式【CPU Time / (CPU核数 * 60)】估算占比。CPU百分比适用于可横向扩展的计划(Basic、Standard、Premium),而CPU时间适用于Free或Shared计划。然而,CPU Percentage包含所有应用及系统占用的CPU,高CPU指标可能由系统而非应用请求引起。详细分析每个进程的CPU占用需抓取Windows Performance Trace数据。
105 40
|
12天前
|
存储 XML 开发工具
【Azure Storage Account】利用App Service作为反向代理, 并使用.NET Storage Account SDK实现上传/下载操作
本文介绍了如何在Azure上使用App Service作为反向代理,以自定义域名访问Storage Account。主要内容包括: 1. **设置反向代理**:通过配置`applicationhost.xdt`和`web.config`文件,启用IIS代理功能并设置重写规则。 2. **验证访问**:测试原生URL和自定义域名的访问效果,确保两者均可正常访问Storage Account。 3. **.NET SDK连接**:使用共享访问签名(SAS URL)初始化BlobServiceClient对象,实现通过自定义域名访问存储服务。
|
9天前
|
JSON 自然语言处理 前端开发
【01】对APP进行语言包功能开发-APP自动识别地区ip后分配对应的语言功能复杂吗?-成熟app项目语言包功能定制开发-前端以uniapp-基于vue.js后端以laravel基于php为例项目实战-优雅草卓伊凡
【01】对APP进行语言包功能开发-APP自动识别地区ip后分配对应的语言功能复杂吗?-成熟app项目语言包功能定制开发-前端以uniapp-基于vue.js后端以laravel基于php为例项目实战-优雅草卓伊凡
105 72
【01】对APP进行语言包功能开发-APP自动识别地区ip后分配对应的语言功能复杂吗?-成熟app项目语言包功能定制开发-前端以uniapp-基于vue.js后端以laravel基于php为例项目实战-优雅草卓伊凡
|
1月前
|
前端开发 安全 开发工具
【11】flutter进行了聊天页面的开发-增加了即时通讯聊天的整体页面和组件-切换-朋友-陌生人-vip开通详细页面-即时通讯sdk准备-直播sdk准备-即时通讯有无UI集成的区别介绍-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
【11】flutter进行了聊天页面的开发-增加了即时通讯聊天的整体页面和组件-切换-朋友-陌生人-vip开通详细页面-即时通讯sdk准备-直播sdk准备-即时通讯有无UI集成的区别介绍-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
176 90
【11】flutter进行了聊天页面的开发-增加了即时通讯聊天的整体页面和组件-切换-朋友-陌生人-vip开通详细页面-即时通讯sdk准备-直播sdk准备-即时通讯有无UI集成的区别介绍-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex

热门文章

最新文章