使用 php 网络文件系统上的图像/视频/mp3
我做了一些谷歌搜索,似乎找不到我想要的东西。我正在设计我的网站以使用 MYSQL、PHP Web 服务器。到目前为止,计划使用多个带有负载均衡器的 Web 服务器和用于扩展的 MySql Custer。但随后我开始查看图像/视频/mp3。我需要一个多个服务器可以读取文件和写入文件的文件系统。因此,一台 Web 服务器可以运行 MySQL、网络文件系统和 Web 服务器,但随着站点的扩展,站点可以切换到多台服务器。有人有任何示例、教程或资源来帮助我吗?该网站在 Ubuntu 服务器上运行。我最初的想法是将图像存储在 MySQL 中(我知道如何做到这一点并且有工作示例),以便所有服务器都可以读/写,但其他人告诉我这是一个坏主意,我应该使用文件系统(但不要'不想使用本地的,因为我认为它不适合大型网站)。
I did some Google searches and can't seem to find what i want. I'm designing my web site to use MYSQL, PHP Web Servers. multiple web servers with load balancers and a MySql Custer for scaling is planed so far. But then i get to images/videos/mp3s. I need a file system multiple servers can read files from and write files to. So one web server can run the MySQL, Networked File System and Web Server, but as the site scales the site can be switched to multiple servers. Does anyone have any examples, tutorials or resources to help me on this? The site runs on Ubuntu Servers. My original idea was to just store the images in MySQL(I know how to do that and have working examples) so all servers could read/write but other people told me thats a bad idea and i should use a file system(but don't want to use the local one, as i don't think it san scale for large sites).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想到了三个系统 - Mogilefs、Mogilefs。 mongodb.org/display/DOCS/GridFS" rel="nofollow">Mongodb GridFS 和基于云的存储解决方案。
MogileFS(OMG 文件!)是为 Livejournal 开发的,并将元数据存储在 Mysql 中。它使用它来查找具有适当文件的实际磁盘并将其流式传输。
MongoDB GridFS 更新得多,而且可能更容易上手,尤其是对于较小的系统。它使用新的“NoSql”数据库来存储其数据库中的部分文件,并根据需要进行组装。四处搜索信息,会发现很多信息。
最后,您可以简单地避免整个问题,只需将图像上传到 Amazon 的 S3 或 Rackspace Cloudfiles。我之前已经完成过后者(尽管该站点已经在 Rackspace 的系统内运行)并且它并不是很困难,同样有大量的示例。
对于 S3,还有一个命令行工具 s3cmd 可以设置为同步(或者更好)上传和然后将充满文件的目录删除到 S3“存储桶”中。
There are Three systems that come to mind - Mogilefs, Mongodb GridFS and a cloud based storage solution.
MogileFS (OMG Files!) was developed for Livejournal and stores metadata in Mysql. It uses that to find the actual disk with the appropriate file and streams it out.
MongoDB GridFS is a lot newer, and probably easier to get going, certainly for a smaller system. It uses a new 'NoSql' database to store parts of files across its database, assembling as required. Searching around for information will find plenty of information.
Finally, you could simply avoid the whole issue and just upload images into Amazon's S3, or Rackspace Cloudfiles. I've done the latter before (though the site was already running inside Rackspace's system) and it's not very difficult, again with plenty of examples around.
For S3 there is also a command-line tool, s3cmd that can be set to sync (or, better) upload and then delete a directory full of files into an S3 'bucket'.
由于最大大小限制,首先存储图像/大文件实际上不可能使用 MySQL
引用这个答案为 MySQL 选择数据类型?
现在,为了存储和升级兼容性,为什么不将它们存储在 NAS 或 Raid 系统上,您可以继续将驱动器附加到该系统上。然后在您的数据库中仅存储文件的路径。以免数据库密集并允许良好的可扩展性。
First storing images/large files is not really possible with MySQL because of the maximum size limitation
To quote this answer Choosing data type for MySQL?
Now for storage and upgrade compatibility why not just store them on an NAS or Raid system that you can continue to tack drives onto. Then in your DB just store a path to the file. Much lest db intensive and allows for decent scalability.