本文介绍了dockerize(containerize)数据库是否有意义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以理解dockerizing无状态服务(例如web服务器,应用程序服务器,负载平衡器等)背后的优势。如果你在一组机器上运行这些服务,很容易用低高架。我不明白,但是集装箱化数据库的目的是什么?数据库连接到在特定硬盘中持久的数据卷。由于状态,实际移动数据库容器不容易,并且效率不高。因此,任何人都可以看到为什么对数据库进行docker化是有用的。

I can understand the benfits behind dockerizing stateless services, such as web servers, appservers, load balancers, etc... If you are running these services on a cluster of machines, it is very easy to move these containers around with low overhead. What I don't understand though is the purpose behind containerizing databases? databases are connected to a data volume that is persistent in a specific hard disk. Because of state, it is not easy, and not efficient to actually move the database container around. So can anyone see why dockerizing a database can be useful at all?

推荐答案

好问题Keeto。对数据库进行容器化的主要原因之一是,您可以为整个应用程序(而不仅仅是无状态部分)提供一致的环境,而不仅限于跨服务器,分段和生产环境。一致的环境是docker的承诺之一,但是当你的数据库在这个模型之外时,有一个很大的区别,不能在你的测试中考虑。此外,通过集中化数据库以及其他应用程序,您更有可能在托管服务提供商之间移动整个应用程序(例如从AWS到Google Compute)。例如,如果您使用Amazon RDS,即使您可以将Web节点移动到Google,您也无法移动数据库,这意味着您很大程度上依赖于云提供商。

Good question Keeto. One of the main reasons for containerizing your databases is so that you can have the same consistent environment for your entire app, not just the stateless parts, across dev, staging and production. A consistent environment is one of the promises of docker, but when your database lives outside this model, there is a big difference that can't be accounted for in your testing. Also, by containerizing your database as well as the rest of your app, you are more likely to be able to move your entire app between hosting providers (say from AWS to Google Compute). If you use Amazon RDS, for example, even if you can move your web nodes to Google, you won't be able to move your database, meaning that you are heavily dependent on your cloud provider.

容器化数据服务的另一个原因是性能。这对于服务提供商(所有数据库作为服务产品尤其如此 - 例如 - 在容器中运行),因为容器允许您提供使用虚拟化无法实现的服务保证,并且每个物理机器运行一个数据库在财务上不可行。您可能没有运行数据库托管服务,但是如果您在裸机上运行,​​并且想要使用容器进行进程隔离,而不是使用VM,则这种类比是很有意义的。由于在VM中运行数据库时所熟知的i / o命中,您将获得更好的数据库性能。

Another reason for containerizing data services is performance. This is particularly true for service providers (all the database as a service offerings- e.g. rackspace cloud databases- run in containers), because containers allow you to provide service guarantees that aren't possible using virtualization, and running one database per physical machine is not financially viable. Chances are you aren't running a databases hosting service, but this analogy makes similar sense if you are running on bare metal and want to use containers for process isolation, instead of VMs. You'll get better performance for your databases because of the well-known i/o hit you take when running a db in a VM.

我不是说你应该容器化你的数据库,但这些是为什么它是有意义的一些原因。

I'm not saying that you should containerize your database, but these are some of the reasons why it would make sense.

完全公开,我在clusterhq工作,新的项目Mark O'connor在他的答案中提到。我们有一个名为Flocker的开源项目,它使得在主机之间迁移数据库及其卷更加容易,这样我在上面提到的好处就不会完全超过你在问题中提出的否定。

Full disclosure, I work for clusterhq, that new project that Mark O'connor mentioned in his answer. We have an opensource project called Flocker that makes it much easier to migrate databases and their volumes between hosts so that the benefits I mentioned above aren't completely outweighed by the negatives that you raised in your question.

这篇关于dockerize(containerize)数据库是否有意义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 13:50
查看更多