MongoDB 作为静态文件提供者?
MongoDB 是作为 CDN 提供静态文件(文件、视频)的良好候选者。我正在寻找一种可靠的方法来存储大量数据(>+To)来取代 S3 并管理缓存功能。 经验。
谢谢。
It's MongoDB a good candidate to serve static files (files, video) as cdn. I searching a solid way to store big amounts of data (>+To) remplacing S3 and managing cache features.
Experiences.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想这个问题的答案是否,因为当您使用 CDN 存储静态文件时,您的服务器将不再受到静态数据请求的影响。但是,当您在文件系统和 mongodb 之间进行选择时,我认为 mongodb 会更快,因为如果服务器上有足够的 RAM,mongo 会将所有数据加载到内存中。
我还找到了一些可以帮助您做出选择的链接: www.markus- gattol.name,groups.google .com
来自文档:
I suppose that the answer to this question is no, because when you are using a CDN to store static files you make your server free from static data requests. But when you are choosing between a file system and mongodb Ii suppose that mongodb will be faster, beacause if there is enough ram on the server, mongo will load all data to the memory.
Also I've found some links that can help you make your choice: www.markus-gattol.name, groups.google.com
From the documentation:
一般来说,答案是肯定的,您可以使用 mongodb 来执行此操作,但 mongodb 没有像 apache/random-webserver 那样提供文件服务的 http 接口。例如,如果您需要添加其他功能,例如这些文件的应用程序身份验证,那么它可能更有意义。
您可以围绕 mongodb 创建一个基础架构,在其中复制更改并编写一个 http 前端来提供文件服务(例如 nginx-gridfs 或任何其他 gridfs http 组件)。但您需要构建/集成这些、测试并部署它们。使用带有标准 Web 服务器的文件系统来提供文件已经过充分的测试和记录;许多系统使用 rsync 来有效地将文件复制到许多节点。
CDN 做了很多事情,您必须重新实现,自己解决所有这些事情可能没有意义,但这确实是另一个问题。
Generally the answer would be yes, you can use mongodb to do this but mongodb does not have an http interface to serve files like apache/random-webserver does. If you need to add additional feature, like application authentication for those files then it might make more sense, as an example.
You can create an infrastructure around mongodb where you replicate changes and write a http front-end to serve files (like nginx-gridfs or any of the other gridfs http components). But you would need to build/integrate these, test and deploy it all. Using a file-system with a standard web-server to provide the files is very well tested and documented; many systems use rsync to efficiently replicate files to many nodes.
There are so many things that a cdn does that you would have to re-implement it might not make sense to tackle all of that yourself, but that is really another question.