将数据库作为Docker容器运行还是在裸机服务器上运行? [英] Run Database as Docker container or on a bare metal server?

查看:348
本文介绍了将数据库作为Docker容器运行还是在裸机服务器上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数据库被设计为消耗所有可用的内存,CPU和IO. 是否有好/坏原因不应该将Docker用于生产中的数据库?

Databases are designed to consume all memory, CPU and IO available to them. Is there are good/bad reasons Docker should not be used for databases in production?

这个问题可能适用于其他工具,例如MOM,Apache Kafka,Apache ActiveMQ等.

May be this question applies to other tools like MOMs Apache Kafka, Apache ActiveMQ etc.

推荐答案

Docker不是完整的虚拟机(至少在Linux上运行时),这只是另一个进程,与主机在同一内核上运行.而且,所有docker容器进程都可以在具有ps aux的主机中看到.

Docker is not a full-scale virtual machine (at least when run on Linux), this is just another process, running on the same kernel, as host machine. Moreover, all docker container processes can be seen in a host machine with ps aux.

Docker唯一的额外负担就是在内核之上加载另一个OS,但是实际上大多数容器都部署了alpine Linux之类的轻量级东西,因此我认为并没有真正考虑到这一点.

The only additional load Docker gives is loading another OS on top of your kernel, but actually most containers are deployed with extremely lightweight stuff like alpine Linux, so I dont think it really has to be taken into consideration.

从另一方面讲,在容器中包含数据库(或任何其他高负载服务)可以为您带来以下好处:

From another point, having Database (or any other high load service) in a containers gives you following advantages:

  • 扩展(使用k8s之类的容器编排工具,可以轻松地将容器分布在节点之间)
  • 易于部署(所有依赖项都在内部)
  • 轻松升级(只需更换容器)
  • 易于测试(无需在运行测试之前进行数据库清理程序) 和其他人
  • Scaling (containers can easily be spread among nodes with container orchestration tools like k8s)
  • Easy deploy (all dependencies are inside)
  • Easy upgrade (just replace the container)
  • Easy testing (no need for db-cleaning procedures in advance of running tests) and others

因此,今天部署容器化服务是正确的做法.

So deploying containerized services today is a right practice.

这篇关于将数据库作为Docker容器运行还是在裸机服务器上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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