简体   繁体   English

Windows Azure和多个存储帐户

[英]Windows Azure and multiple storage accounts

I have an ASP.NET MVC 2 Azure application that I am trying to switch from being single tenant to multi-tenant. 我有一个ASP.NET MVC 2 Azure应用程序,我试图从单租户切换到多租户。 I have been reviewing many blogs and posts and questions here on Stack Overflow, but am still trying to wrap my head around the specifics of what's right for this particular app. 我一直在审查Stack Overflow上的许多博客和帖子和问题,但我仍然试图围绕这个特定应用程序的特定内容。

Currently the application stores some information in a SQL Azure database, as well as some other info in an Azure Storage Account. 目前,该应用程序将一些信息存储在SQL Azure数据库中,以及Azure存储帐户中的一些其他信息。 I'm considering writing the tenant provisioning code to simply create a new database for a new tenant, along with a new azure storage account. 我正在考虑编写租户配置代码,以便为新租户创建一个新数据库,以及一个新的azure存储帐户。 This brings me to the following question: 这让我想到以下问题:

How will I go about testing this approach locally? 我将如何在本地测试此方法? As far as I can tell, the local Azure Storage Emulator only has 1 storage account. 据我所知,本地Azure存储模拟器只有1个存储帐户。 I'm not sure if I'm able to create others locally. 我不确定我是否能够在本地创建其他人。 How will I be able to test this locally? 我怎样才能在本地测试? Or will it be possible? 或者它可能吗?

There are many aspects to consider with multitenancy, one of which is data architecture. 多租户有许多方面需要考虑,其中一个是数据架构。 You also have billing, performance, security and so forth. 您还拥有计费,性能,安全性等。

Regarding data architecture, let's first explore SQL storage. 关于数据架构,让我们首先探讨SQL存储。 You have the following options available to you: add a CustomerID (or other identifyer) that your code will use to filter records, use different schema containers for different customers (each customer has its own copy of all the database objects owned by a dedicated schema in a database), linear sharding (in which each customer has its own database) and Federation (a feature of SQL Azure that offers progressive sharding based on performance and scalability needs). 您可以使用以下选项:添加代码将用于过滤记录的CustomerID(或其他标识符),为不同的客户使用不同的模式容器(每个客户都有自己的专用模式拥有的所有数据库对象的副本)在数据库中),线性分片(每个客户都有自己的数据库)和联合(SQL Azure的一个功能,它提供基于性能和可伸缩性需求的渐进分片)。 All these options are valid, but have different implications on performance, scalability, security, maintenance (such as backups), cost and of course database design. 所有这些选项都是有效的,但对性能,可伸缩性,安全性,维护(例如备份),成本以及数据库设计有不同的影响。 I couldn't tell you which one to choose based on the information you provided; 根据您提供的信息,我无法告诉您选择哪一个; some models are easier to implement than others if you already have a code base. 如果您已经拥有代码库,某些模型比其他模型更容易实现。 Generally speaking a linear shard is the simplest model and provides strong customer isolation, but perhaps the most expensive of all. 一般来说,线性分片是最简单的模型,可以提供强大的客户隔离,但也许是最昂贵的。 A schema-based separation is not too hard, but requires a good handle on security requirements and can introduce cross-customer performance issues because this approach is not shared-nothing (for customers on the same database). 基于模式的分离并不太难,但需要很好地处理安全性要求,并且可能引入跨客户性能问题,因为这种方法不是无共享的(对于同一数据库中的客户)。 Finally Federations requires the use of a customer identifyer and has a few limitations; 最后,联合会需要使用客户识别器,并且有一些限制; however this technology gives you more control over performance distribution and long-term scalability (because like a linear shard, Federation uses a shared-nothing architecture). 但是,这项技术可以让您更好地控制性能分布和长期可扩展性(因为像线性分片一样,Federation使用无共享架构)。

Regarding storage accounts, using different storage accounts per customer is definitively the way to go. 关于存储帐户,每个客户使用不同的存储帐户绝对是最佳选择。 The primary issue you will face if you don't use separate storage accounts is performance limitations, such as the maximum number of transactions per second that can be executed using a single storage account. 如果不使用单独的存储帐户,将面临的主要问题是性能限制,例如可以使用单个存储帐户执行的每秒最大事务数。 As you are pointing out however, testing locally may be a problem; 然而,正如您所指出的那样,本地测试可能是一个问题; however consider this: the local emulator does not offer 100% parity with an Azure Storage Account (some functions are not supported in the emulator). 但请考虑这一点:本地模拟器不提供与Azure存储帐户的100%奇偶校验(模拟器中不支持某些功能)。 So I would only use the local emulator for initial development and troubleshooting. 所以我只会使用本地模拟器进行初始开发和故障排除。 Any serious testing, including multitenant testing, should be done using real storage accounts. 任何严肃的测试,包括多租户测试,都应该使用真实的存储帐户来完成。 This is the only way you can fully test an application. 这是您可以完全测试应用程序的唯一方法。

You should consider not creating separate databases, but instead creating different object namespaces within a single SQL database. 您应该考虑不创建单独的数据库,而是在单个SQL数据库中创建不同的对象命名空间。 Each tenant can have their own set of tables. 每个租户都可以拥有自己的一组表。

Depending on how you are using storage, you can create separate storage containers or message queues per client. 根据您使用存储的方式,您可以为每个客户端创建单独的存储容器或消息队列。

Given these constraints you should be able to test locally with the storage emulator and local SQL instance. 鉴于这些约束,您应该能够使用存储模拟器和本地SQL实例进行本地测试。

Please let me know if you need further explanation. 如果您需要进一步说明,请与我们联系。

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

相关问题 Windows Azure 表存储帐户的限制 - Limitations on Windows Azure Table Storage accounts Windows服务帐户的Azure文件存储访问 - Azure File Storage Access for Windows Service Accounts 用于Azure日志集成的多个存储帐户 - Multiple Storage Accounts for Azure Log Integration 有没有办法在多个 Azure 存储帐户上设置雪管? - Is there a way to setup a Snowpipe on multiple Azure Storage Accounts? 提供对多个存储帐户的 Azure VM 访问 - Provide Azure VM access to multiple Storage Accounts Azure CDN的后备存储帐户(或多个存储帐户) - Fallback storage account (or multiple storage accounts) for Azure CDN 关于 Azure 可扩展性目标和使用多个 Azure 存储帐户的问题? - Questions on the Azure scalability targets and the use of multiple Azure storage accounts? 如何创建Azure函数以访问多个Azure Blob存储帐户? - How to create azure function to access multiple azure blob storage accounts? 有没有办法引用具有不同前缀的多个Azure存储帐户? - Is there a way to reference multiple Azure Storage accounts with different prefixes? 在 Azure 中使用相同存储帐户的多个 VM - Multiple VM's using the same storage accounts in Azure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM