Saas模式数据隔离
我目前有一个使用 symfony 框架用 php 编写的应用程序。我不想在托管服务器上为客户单独安装,而是希望转向 SaaS 模型,为所有可能运行 Google 代码或其他基于云的服务的客户进行一次安装。尽管我希望获得一个好的框架的好处,但我并没有依赖 PHP。
因此,挑战是:如果所有客户都使用相同的应用程序,那么我们就必须找到一种方法来隔离每个客户的数据。例如,客户拥有管理员访问权限,可以管理自己的用户和权限。在简单化的层面上,您可以在每个表中拥有一个组织标识符,并将其添加到所有数据库操作中。然而,大多数应用程序框架都使用某种 ORM,而且我还没有找到一个能够轻松/似乎在对应用程序代码影响最小的水平上实现这一点的框架。
有没有人看过这个,有没有解决这个问题的好方法?
I curently have an application writen in php using the symfony framework. Rather than have seperate installs for customer on a hosted server, I would like to move to as SaaS model with one install for all customers posible running of google code or another cloud based service. I am not tied to PHP though i would like to have the benifits of a good framework.
So the chalenge: If all customers are using the same application we then have fin a way isolating each customers data. Customers do for eample have admin access and can manager their own users and privlages. At a simplistic leve you could just have a organisation identifier in each table take and add that to all database operations. However most application framewors use and ORM of some kind, and I have not been able to find one that will easly / seemlesly facinatate this at a leve the has minimum impact on the application code.
Has anyone looked at this, are there any good aproaches to this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如 Itay 所说,多租户系统是一种常见的需求。不久前,我正在对这个问题进行一些研究,并发现了一个关于处理此问题的不同方法以及每种方法的优缺点的非常好的演示:http://aac2009.confreaks.com/06-feb-2009-14-30-writing-multi-tenant-applications-in-rails-guy-naor.html
这个特定的演示文稿面向 Rails 受众,但原则与任何语言相同。
As Itay says, a multi-tenant system is a common requirement. A while back I was doing some research on this problem and came across a pretty good presentation on the different ways to handle this issue, and the pros and cons of each: http://aac2009.confreaks.com/06-feb-2009-14-30-writing-multi-tenant-applications-in-rails-guy-naor.html
This particular presentation is targeted to a Rails audience, but the principles are the same as with any language.
您描述的方法很常见,PHP(优势之一)将允许您相对轻松地进入 ORM 代码并根据您的需要进行修改。
第二种方法是为每个组织创建一个单独的数据库,并为共享资源创建一个联合数据库。
有点设计挑战(但只是一点)。
如果你真的很大,那么你甚至需要考虑为每个组织配备一个单独的数据库服务器(我想说这在 99.99999% 的情况下是严重的矫枉过正)。
The approach you described is common, and PHP (One of the strengths) will allow you to comparatively easily go into the ORM code and modify it to your needs.
Second approach is to create a separate DB for each organization and a joint DB for shared resources.
A bit of a design challenge (but just a bit).
if you are really big, then you will even need to consider a separate DB server for each organization (I would say this is a serious overkill in 99.99999% of the cases).
这篇 MSDN 文章为您提供了多租户数据架构的非常好的概述:http: //msdn.microsoft.com/en-us/library/aa479086.aspx
This MSDN article gives you a very good overview of Data Architecture in Multi-tenancy: http://msdn.microsoft.com/en-us/library/aa479086.aspx