首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Docker存储数据的好策略?

问使用Docker存储数据的好策略?
EN

Stack Overflow用户
提问于 2016-01-08 11:13:11
回答 1查看 725关注 0票数 2

对于我的应用程序,我正在考虑使用Docker容器,在这里,我想在容器中运行一些复杂的客户关系管理系统,比如SugarCRM,我的问题是,我的策略应该是如何处理卷和数据存储?

我正在考虑使用IBM容器,我想知道如何将数据存储在外部服务中?在集装箱里?你认为什么是最好的策略?也许我不理解容器的概念,它们是否应该仅仅用作托管应用程序的环境呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-01-08 13:45:41

你的问题非常广泛,没有什么可以说是“最佳策略”。我尽我最大的努力引导你走向正确的方向,我希望这对你有帮助。

你的问题包含了几个关于存储的元素,我试着一个接一个地简单地讨论它们。

  1. 考虑客户数据:(我指的是应该安全和正确存储的数据)
代码语言:javascript
复制
- Regarding database storages, since you've decided to use BlueMix try to utilise external data stores if possible. All sort of cloud storages from RDBMS to NoSql are available with very good prices.
- If you want to use you're own database and data stores, you can use host file system mounted into your docker containers and make sure they are setup and backed-up correctly. You can achieve this by simply mounting you volume using `-v` in Docker.
- If you want you can also use something called 'Data Containers'. Docker can provide data volumes inside docker containers and they are independent from containers life cycles, and never get garbage collected. So how it works, is that you create a dummy container with a volume using `-v` but no host path. And then you start another container and use `--volumes-from`. More info: [https://docs.docker.com/engine/userguide/dockervolumes/](https://docs.docker.com/engine/userguide/dockervolumes/)
- You can use some external volume plugins to move around you data volumes easily across your fleet and make sure they are available to docker containers when ever needed. I bit more complicated setup but very interesting and fun ;-) Like Flocker: [https://clusterhq.com/docker-plugin/](https://clusterhq.com/docker-plugin/) or GlusterFS: [https://github.com/calavera/docker-volume-glusterfs](https://github.com/calavera/docker-volume-glusterfs) and more: [https://github.com/docker/docker/blob/master/docs/extend/plugins.md](https://github.com/docker/docker/blob/master/docs/extend/plugins.md)
- You can also store data into cloud data storages for example Elastic support Amazon S3 for storage snap shots so you can rely on that, to me this does not sound fool proof but it's an option anyway :-)

​

  1. 下一类是从容器中生成的数据,但实际上不是客户数据,比如日志记录信息。对于这些人,也有两种选择:
代码语言:javascript
复制
- You can again mount a volume from host and store data in your host, back up and send somewhere using logstash for example.
- You can use various logging plugins and containers that collect data directly from docker daemon, like: loggly or logentries and may more.
- You can mount syslog `/dev/syslog` socket directly into you app's container and send data to your host syslog and then collect them using various available mechanisms.
- If you're using `systemd` then `journald` already got all your docker logs and thus application logs if it goes into `stdout` or `stderr` you can collect using `journalctl` and do whatever you want.

​

这只是冰山一角。如果你需要更多信息,请告诉我,也许我能帮上忙。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34675697

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档