本文介绍了多个独立的 mariadb 用法:多个容器还是一个?隔离与效率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个架构问题.

假设我们有一个系统,它有多个子系统:AB 等等.这些子系统中的每一个都需要持久化它们的数据,它们都使用 MariaDB.子系统A可能需要一个名为a_dbdatabase(如create database ...);子系统B可能需要一个名为b_db的数据库.此外,AB

Suppose we have a system that has multiple sub-systems: A, B, and so on. Each of these sub-system needs to persist their data and they all use MariaDB. Sub-system A may need a database (as in create database ...) called a_db; and Sub-system B may need a database called b_db. Furthermore, there are no data sharing across A and B

在微服务和 docker 之前的单体世界中,通常会设置一个中央 MariaDB 实例并要求每个子系统使用它并且只使用你自己的 database 在共享实例上(也就是说,A 使用 a_dbB 使用 b_db,等等)

In a monolithic world before microservice and docker, it is common to set up one central MariaDB instance and ask each sub-system to use it and to just use your own database while on the shared instance (That is, A uses a_db, B uses b_db, and so on)

使用 docker,我认为我们还可以运行多个 mariadb 容器,每个容器都映射自己的存储卷(例如 /data/mdb_a/data/mdb_b,分别).

With docker, I think we could also have multiple mariadb containers running, and each maps their own volume for storage (e.g. /data/mdb_a and /data/mdb_b, respectively).

一个明显的优势是 AB 之间的完全隔离.不用担心A 可能会不小心弄乱B 的数据.两个子系统可以独立选择关闭/重启自己的 MariaDB 容器,甚至升级自己的 MariaDB 二进制文件.

An obvious advantage would be complete isolation between A and B. There would be no worries that A may accidentally mess with B's data. And the two sub-systems can independently choose to shutdown/restart their own MariaDB container or even upgrade their MariaDB binary.

另一方面,我的一些同事认为运行多个 MariaDB 容器效率低下,而且这种方法会造成资源浪费.

On the other hand, some of my colleagues argue that running multiple MariaDB containers is inefficient and this approach imposes waste of resources.

他们良好的实证测量和文章是否讨论了两种方法之间的权衡?

Are their good empirical measurements and articles discuss the trade-offs between the two approaches?

推荐答案

容器化世界中的持久性存储仍处于起步阶段,并且在运行多个数据库副本(在这种情况下)的高流量环境中可能会出现问题, mariadb).

Persistent storage in the containerized world is still in its infancy, and can be problematic in high traffic environments when running more than one replica of your database(in this case, mariadb).

运行多个带有共享持久数据存储(例如 NFS)的 mariadb 副本,无论您使用多少数据库,都可能导致一些损坏问题.

Running more than one mariadb replica, with shared persistent data storage(e.g. NFS), regardless of the number of databases you use, could cause some corruption issues.

我自己没有经历过这些事情,但是在生产中做任何事情之前,您应该进一步研究在容器中运行数据库.网络上有很多关于此的文章.

I have not experienced these things myself, but you should research running databases in containers further, before doing anything in production. There are lots of articles on the web about this.

很多人仍然在虚拟机或裸机上运行他们的数据库,并且只在容器中运行数据库以进行本地开发.

A lot of people still run their databases in VM's, or on bare metal, and only run databases in containers for local development only.

这篇关于多个独立的 mariadb 用法:多个容器还是一个?隔离与效率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 04:30