Multiple docker containers for mysql or one instance with multiple databases

…衆ロ難τιáo~ 提交于 2019-12-03 08:21:52

问题


I have a question regarding best practices using docker containers.

I need one database for each application I develop. Now my question is whether I should use one mysql docker instance with multiple databases inside or should I create one instance for each database. The disadvantage I see with creating one instance per database is that I can't have a user which has access to all database. I know this is a pro for security reasons but when I try to backup from a client than I need to go in every instance for backup up. And isn't multiple instance using to much overhead of resources (although mysql may be using less resource, but using e.x. mssql instance which is quit bigger may cause resource problems later)

My question is what is the common way to do it with docker and what are the pros and contras?


回答1:


Docker is especially suited to the deployment of microservices. The following links discuss two strategies with regard to the use of databases:

  1. Database per service
  2. Shared database

I personally favour the use of a single database per service and extend that to the deployment of separate instances of a database server. This ensures services are loosely coupled, should one service suffer a DB outage, it won't impact another.



来源:https://stackoverflow.com/questions/41883605/multiple-docker-containers-for-mysql-or-one-instance-with-multiple-databases

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!