如何设置共享永久存储多个AWS EC2实例?多个、如何设置、实例、AWS

2023-09-11 09:37:24 作者:为下一秒开心

我托管在Amazon Web Services服务。在那里,我有完全相同的设置和数据,通过弹性负载均衡和扩大集团管理运行多个EC2实例。

I have a service hosted on Amazon Web Services. There I have multiple EC2 instances running with the exact same setup and data, managed by an Elastic Load Balancer and scaling groups.

这些实例在运行基于PHP的Web应用程序的Web服务器。因此,目前主要有放置在每一个实例在同一个文件等等。但是,当ELB /缩放集团推出基于负载的规则等新的实例,这些文件可能无法达到最新的。 此外,我宁愿喜欢使用共享文件系统的PHP会话等方面比粘性会话。

Those instances are web servers running web applications based on PHP. So currently there are the very same files etc. placed on every instance. But when the ELB / scaling group launches a new instance based on load rules etc., the files might not be up-to-date. Additionally, I'd rather like to use a shared file system for PHP sessions etc. than sticky sessions.

所以,我的问题是,对于这些原因,也许更多即将在未来,我想有我可以连接到我的EC2实例的共享文件系统的实体。 你会建议什么办法解决呢?是否有由AWS直接提供的,所以我可以靠自己的服务,而不是做它在我的上一个DRBD等任何解决方案?什么是最简单的方法? DRBD,NFS,...?是S3也是可行对于那些打算?

So, my question is, for those reasons and maybe more coming up in the future, I would like to have a shared file system entity which I can attach to my EC2 instances. What way would you suggest to resolve this? Are there any solutions offered by AWS directly so I can rely on their services rather than doing it on my on with a DRBD and so on? What is the easiest approach? DRBD, NFS, ...? Is S3 also feasible for those intends?

在此先感谢。

推荐答案

正如评论,AWS宣布EFS(的 http://aws.amazon.com/efs/ )共享的网络文件系统。它是目前在非常有限的preVIEW,但基于previous AWS服务我希望看到它一般可在未来数个月。

As mentioned in a comment, AWS has announced EFS (http://aws.amazon.com/efs/) a shared network file system. It is currently in very limited preview, but based on previous AWS services I would hope to see it generally available in the next few months.

在此期间有一些第三方的共享文件系统解决方案,AWS如SoftNAS https://aws.amazon.com/marketplace/pp/B00PJ9FGVU/ref=srh_res_product_title?ie=UTF8&sr=0-3&qid=1432203627313

In the meantime there are a couple of third party shared file system solutions for AWS such as SoftNAS https://aws.amazon.com/marketplace/pp/B00PJ9FGVU/ref=srh_res_product_title?ie=UTF8&sr=0-3&qid=1432203627313

S3是可能的,但始终不理想,主要拦截是它本身不支持任何文件系统的协议,而不是所有的交互必须通过AWS API或通过HTTP调用。此外,当在使用它的会话存储最终一致性的模式可能会造成问题寻找。

S3 is possible but not always ideal, the main blocker being it does not natively support any filesystem protocols, instead all interactions need to be via an AWS API or via http calls. Additionally when looking at using it for session stores the 'eventually consistent' model will likely cause issues.

话虽这么说 - 如果你需要的是更新的资源,你可以创建一个简单的脚本来运行无论是作为cron或在启动时从S3下载文件

That being said - if all you need is updated resources, you could create a simple script to run either as a cron or on startup that downloads the files from s3.

最后,在像CSS /图像不把它们存储在摆在首位您的Web服务器的静态资源的情况下 - 有大量的文章,介绍了存储和直接从S3访问静态Web资源,同时保持动态的东西的好处您的服务器。

Finally in the case of static resources like css/images don't store them on your webserver in the first place - there are plenty of articles covering the benefit of storing and accessing static web resources directly from s3 while keeping the dynamic stuff on your server.