集群环境中的资产管理

发布于 2024-08-14 09:33:26 字数 261 浏览 3 评论 0原文

我有一个在 Web 服务器上运行的内容管理系统,该系统允许用户将图像、文件等资产上传到服务器。

我遇到的问题是,负载均衡器后面将运行两台服务器,我正在尝试找到一种有效的方法来处理资产管理。

我的问题是:

资源每次都会上传到一台服务器吗?或者图像/文件是否有可能根据负载最终进入服务器 1 或服务器 2?

如果我不知道图像最终位于哪个服务器上,如何提供图像?我是否必须在两台服务器之间保持这些资产(图像/文件)的目录同步?

谢谢,

I have a content management system running on a web server, that among others allows the user to upload assets like images, files, etc to the server.

The problem i have is that there will be 2 servers running behind a load balancer and i am trying to find an efficient way to handle the assets management.

The question i have is:

Will the assets be uploaded to one server every time? Or is there a chance that the images/files will end up into server1 or server2 depending on the load?

How to i serve the images if i don't know on which server they end up in? Will i have to keep the directories of these assets (images/files) synchronized between the two servers?

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一紙繁鸢 2024-08-21 09:33:26

同步是一个很难解决的问题。您可以使用 Couchdb 进行临时同步,但这需要对低级问题有很好的了解。因此你需要选择一个写入大师。

DRDB

你可以看看 DRDB :D 使用一台服务器作为 write-master另一个是奴隶。然后您可以服务器两者的内容。这种方法对于数据库对来说非常神奇。

注意:将 write-master 和 server-only 的代码和 URL 分开会很烦人

Couchdb

您可以使用 couchdb 但我认为这可能有点矫枉过正。这是针对大量数据和高水平容错的情况。

NFS

您可以将 write-master 上的资产目录导出为 nfs 驱动器,然后从其他计算机导入。但在这种情况下,它不会在所有情况下实现负载平衡——即,仅当文件由从属设备缓存时。您可以使用第三台计算机作为 NFS 服务器——这将允许您扩展到更多的 Web 服务器。

中央 NFS 服务器可能是您的最佳解决方案,因为您可以在没有写入主机的情况下完成,因为每个前端服务器都可以执行写入操作。这是我会使用的方法,除非我正在考虑超越 peta 字节范围:P

Synchronization is a tough problem to crack. You can do ad-hoc synchronization using Couchdb but that requires good knowledge of the low-level issues. Therefore you need to choose a write master.

DRDB

You could look at DRDB :D Use one server as the write-master and the other as the slave. Then you can server content from both. This approach is amazing for database-pairs.

Note: seperating your code and URL's for write-master and serve-only will be anoying

Couchdb

You could use couchdb but I think that might be overkill. This is for the LARGE amounts of data and high-levels of fault tolerance.

NFS

You could export the asset directory on the write-master as an nfs drive and import it from the other computer. But in this case it wouldn't be load-balanced in all cases -- i.e., only if the files are cached by the slave. You could use a third computer as an NFS server -- this would allow you to scale to more web-servers.

A central NFS server might just be your best solution as you can do without a write-master as every front-end server can perform writes. This is the approach I would use unless I am thinking of going past the peta-byte range :P

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文