可能是一个菜鸟问题,但无法在网上得到明确的答案,所以请帮助。 情景是:我有两个php服务器实例(比方说A和B),负载平衡的一个实例和mysql之一。 堆栈已经准备就绪,但在我看来,用户上传的照片会发生一些混乱。
Suppose user comes to sever 'A' through load balancer and uploads the image which gets stored on my "webroot" folder on server 'A'. Now after few days user visits the website again and this time hits server 'B'. He won't be able to see his image as it is residing on server 'A'. I want to know how AWS opswork handles this problem?? Will it sync the data automatically or some extra chef receipe needs to be created from my side.
请在这里指导我。 我正在将opswork应用到我的网站,这个混乱不让我继续。 任何链接将是有用的。
简短的回答:没有。
您需要考虑应用程序中的应用程序状态(包括上传的文件)。 uploadednfiles经常使用的devise模式是使用S3来存储,而不是使用本地文件系统
另一个select是有一个长期运行的(非ASG)存储服务器,通过NFS将文件系统导出到您的应用程序服务器,然后他们都使用它来上传内容。
不,数据将不会同步。
AWS上的典型方法是让您的应用程序将file upload到Amazon S3,而不是将其保留在单个实例上。 这可以在客户端使用JavaScript( http://www.plupload.com/是我过去使用过的)完成,也可以在脚本的服务器端完成。