How to design a multi tenant mysql database(如何设计一个多租户的mysql数据库)
问题描述
假设我需要设计一个数据库,该数据库将托管多个公司的数据.现在出于安全和管理目的,我需要确保不同公司的数据被正确隔离,但我也不想启动 10 个 mysql 进程来在 10 台不同的服务器上托管 10 家公司的数据.使用 mysql 数据库执行此操作的最佳方法是什么.
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.
- 每个租户一个数据库.
- 共享数据库,每个架构一个租户.
- 共享数据库,共享架构.租户标识符(租户键)将每一行与正确的租户相关联.
MSDN 有一篇关于 每种设计的优缺点,以及实现示例.
MSDN has a good article on the pros and cons of each design, and examples of implementations.
<小时>微软显然已经删除了我提到的页面,但它们在 archive.org 上.链接已更改为指向那里.
Microsoft has apparently taken down the pages I referred to, but they are on on archive.org. Links have been changed to point there.
作为参考,这是第二篇文章的原始链接一个>
这篇关于如何设计一个多租户的mysql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何设计一个多租户的mysql数据库


- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- SQL 临时表问题 2022-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01