对于我的应用程序,我正在考虑使用Docker容器,在这里,我想在容器中运行一些复杂的客户关系管理系统,比如SugarCRM,我的问题是,我的策略应该是如何处理卷和数据存储?
我正在考虑使用IBM容器,我想知道如何将数据存储在外部服务中?在集装箱里?你认为什么是最好的策略?也许我不理解容器的概念,它们是否应该仅仅用作托管应用程序的环境呢?
发布于 2016-01-08 13:45:41
你的问题非常广泛,没有什么可以说是“最佳策略”。我尽我最大的努力引导你走向正确的方向,我希望这对你有帮助。
你的问题包含了几个关于存储的元素,我试着一个接一个地简单地讨论它们。
- 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 :-)
- 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.
这只是冰山一角。如果你需要更多信息,请告诉我,也许我能帮上忙。
https://stackoverflow.com/questions/34675697
复制相似问题