多个 AWS EC2 实例之间的共享存储 [英] Shared storage between multiple AWS EC2 instances
问题描述
我在多个 EC2 实例之间共享存储时遇到问题.我将不得不运行繁重的工作,所以我需要很多实例来完成它.一方面,我有一个 EBS 卷附加到一个服务器实例.另一方面,我有一个工作实例.我创建了这个工作实例的 AMI,然后我创建了这个 AMI 的几个实例副本.都运行在同一个 VPC 上.基本上,服务器实例正在发送作业,而工作人员正在执行作业.当我的工作人员运行作业时,我想在共享存储中保存一些日志文件,例如:
I'm facing a problem to share a storage between multiple EC2 instances. I'm going to have to run heavy jobs so I'll need a lot of instances to do it. On one side ,I have an EBS volume attached to one server instance. On the other side I have a a worker instance. I created an AMI of this worker instance and then I created several instances copies of this AMI. There are all running on the same VPC. Basically the server instance is sending jobs and the workers are executing the job. I would like to save some log files when my workers are running the jobs, in the share storage something like:
worker_1/日志文件.log
worker_1/ logfile.log
worker_2/日志文件.log
worker_2/ logfile.log
什么是最好的解决方案?
What could be the best solution to do that?
- 我了解到无法将相同的 EBS 卷附加到多个实例.
- 我查看了 GlusterFS,但我发现了以下内容:
- I read it's not possible to attach the same EBS volume to multiple instances.
- I had a look at GlusterFS but here is what I found:
在使用两台服务器实现概念验证之前,在不同的可用区,使用 ext4 文件系统复制 EBS 卷,我们将列出不应使用 GlusterFS 的情况:从多个服务器同时写入的顺序文件,例如日志.如果您将日志存储在 GlusterFS 中,锁定系统可能会导致严重的问题.理想的解决方案是将它们存储在本地,然后使用 S3 将它们存档.如有必要,我们可以在将多个服务器日志存储到 S3 之前或之后对其进行合并."
- 最后,我还检查了安装有 s3fs 的 S3 存储桶,但我发现这也不是一个好的选择:
- And finally, I've also checked S3 bucket mounted with s3fs but I found out it's not a good option too:
您无法使用 s3fs 部分更新文件,因此更改单个字节将重新上传整个文件".然后,如果您想进行小的增量更改,则绝对不可以.您不能使用 s3fs - S3 只是不能那样工作,您无法增量更改文件."
那么什么是解决我的问题并允许我的工作人员将他们的日志文件写入共享存储的好方法?
Then what could be a good solution to my problems and allows my workers to write their log files in a share storage?
感谢您的帮助!
罗曼佐
推荐答案
感谢您的回答.但最后我在实例之间使用了 NFS,而且效果很好!
Thanks for the answers. but finally I'm using NFS between the instances and it works pretty well!
这篇关于多个 AWS EC2 实例之间的共享存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!