其中多租户的做法,建议与SQL Server 2008 [英] Which Multi-tenant approach is recommended with SQL Server 2008

查看:1143
本文介绍了其中多租户的做法,建议与SQL Server 2008的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用ASP.NET MVC 3或以上和SQL Server 2008作为每个的多租户数据架构后,有3种方式来实现多租户

I have to use ASP.NET MVC 3 or above and SQL Server 2008. As per Multi-Tenant Data Architecture post, there are 3 ways to implement multi-tenancy


  1. 单独的数据库

  1. Separate Databases

共享数据库,不同的模式

Shared Database, Separate Schemas

共享数据库,共享模式

我有以下细节:


  1. 用户应该能够备份和恢复他们的数据。

  2. 没有租户:1000(约)

  3. 每个租户可能属于不同的域(URL)。

  4. 它必须支持居民的监控和管理。

  5. 它必须支持为每个租户
  6. 用户认证和授权
  7. 它必须支持租户定制(启用设置禁用功能)

  8. 无每个租户表:100(初始)

  1. User should be able to backup and restore their data.
  2. No of tenants : 1000 (approx)
  3. Each tenant might belong to different domain(url).
  4. It must support monitoring and management of tenants.
  5. It must support user authentication and authorization for each tenant
  6. It must support tenant customization(enable disable features set)
  7. No of tables in each tenant: 100 (initial)

我想知道你的经验怎么说哪个方式更适合该项目考虑经济与安全?有没有类似这样的实时性好例子(开源项目)?我可以使用一个专用的服务器项目。

I would like to know what your experience says about which approach is more suitable for the project considering Economic and Security? Is there any good real time example(open source project) similar to this? I can use one dedicated server for the project.

推荐答案

您的要求,用户应该能够备份其数据,可achivable更容易与入路1和2 ...因为这将是一个本地数据库任务

Your requirement that users should be able to backup its data, can be achivable more easily with approachs 1 and 2... since it will be a native database task.

如果您在方法3(共享共享),您将需要开发提取所有属于一个租户的行和导出为一个XML文件或类似的东西的逻辑。然后,如果你需要允许用户还原备份文件,你需要制定一个恢复的逻辑。

If you are in approach 3 (shared-shared), you will need to develop the logic to extract all the rows belonging to a single tenant and export it in a xml file or something like that. Then if you need to allow users to restore that backup file, you need to develop a restore logic.

我认为这是一个可以让你从#3移开唯一的要求。

I think this is the only requirement that could make you move away from #3.

一旦你在你的表使用TenantID列设置你的数据库...你可以很容易地使用一个数据库1租客或一小群租户,如果你的客户是严重担心安全问题。例如,你可以有一个数据库保存住户未支付(免费/模拟账户),并在另外一个付费用户。这样,您使用的方法#3,但能够如果你需要它表现为#1。

Once you set your database using TenantID columns in your table... you can easily use one database for 1 tenant or a small group of tenants if your client is heavily concerned about security. For instance, you could have one database holding tenants that are not paying (free/demo accounts) and paying customers in another one. This way you are using approach #3, but being able to behave as #1 if you need it.

:::奖金:::

::: BONUS :::

验证:
您需要延长您的MVC3的应用使用SQL成员资格和角色提供程序......让用户登录只有在它所属的租户是有效的。

AUTHENTICATION: You will need to extend the SQL Membership and Role Providers used in your MVC3 app... so that a user login is valid only in the Tenant it belongs to.

多个域
在这里,你可以看到使用ASP.NET MVC3路由的一些方法:
  MVC 3子域路由

这篇关于其中多租户的做法,建议与SQL Server 2008的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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