如何设计多租户mysql数据库 [英] How to design a multi tenant mysql database

查看:4511
本文介绍了如何设计多租户mysql数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们说,我需要设计一个数据库,为多家公司托管数据。现在为了安全和管理目的,我需要确保不同公司的数据被正确隔离,但我也不想启动10个mysql进程托管10个公司的数据在10个不同的服务器。使用mysql数据库的最好方法是什么。

解决方案

多租户数据库有多种方法。




  • 每个租户一个数据库。

  • 共享数据库,每个
    租户一个模式。

  • 共享数据库,共享模式。 http://msdn.microsoft.com/en-us/library/aa479086.aspxrel =noreferrer>每种设计的利弊。


    Let us say I need to design a database which will host data for multiple companies. Now for security and admin purposes I need to make sure that the data for different companies is properly isolated but I also do not want to start 10 mysql processes for hosting the data for 10 companies on 10 different servers. What are the best ways to do this with the mysql database.

    解决方案

    There are several approaches to multi-tenant databases. For discussion, they're usually broken into three categories.

    • One database per tenant.
    • Shared database, one schema per tenant.
    • Shared database, shared schema. A tenant identifier (tenant key) associates every row with the right tenant.

    MSDN has a good article on the pros and cons of each design.

    这篇关于如何设计多租户mysql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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