多种独立的mariadb用法:多个容器还是一个?隔离与效率? [英] Multiple independent mariadb usages: multiple containers or one? Isolation vs efficiency?

查看:81
本文介绍了多种独立的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).

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

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.

许多人仍然在VM或裸机上运行他们的数据库,并且仅在容器中运行数据库,仅用于本地开发.

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用法:多个容器还是一个?隔离与效率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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