多个 EC2 实例(扩展)如何在一个 EBS 上进行数据存储?

发布于 2024-10-14 19:04:16 字数 680 浏览 3 评论 0原文

因此,在一种简单的情况下,如果只有一个实例,那么我可以将数据存储到安装在该实例上的 EBS 卷中。例如 /mnt/db

但是,如果我扩展并具有多个实例(静态或动态扩展),它如何工作?

因为一个EBS只能附加到一个实例,如果我有多个实例,是否意味着我必须为每个实例附加一个EBS卷?如果是这种情况,每个实例的 EBS 卷上的数据将会不同。

显然,我希望所有实例都访问(R& W)单个卷(作为数据存储)。并且卷中的数据会不断增长并且不会出现停机情况。

解决办法是什么?有没有一种方法可以让我不挂载设备(EBS),而只是调用它来访问数据?

这是我能想到的: 1)如果每个实例都有自己的EBS卷,那么每个时间间隔(例如1小时),所有实例都会卸载并卸载。分离 EBS 卷,然后附加一个新卷。然后有一个强大的实例,可以挂载刚刚分离的所有 EBS 卷,并聚合所有数据。 2) 或类似于 1),我只是在所有实例的所有卷上拍摄快照,而不是分离和附加。然后强大的实例聚合快照中的数据。并将结果保存到另一个 EBS 或 S3 中。

这两种方法似乎有效......但需要大量工作。有没有更聪明的方法来解决这个问题?谢谢。

  • 顺便说一下,由于性能问题,我无法让实例将数据写入S3。 :)

哦这个怎么样 3)首先,所有实例都有自己的EBS,并将数据写入EBS。然后每小时将数据发送到S3。然后另一个实例将聚合它们。

So, in a simple situation, if there is only one instance, then I can store the data into a EBS volume mounted on that instance. e.g. /mnt/db

However, how does it work if I scale and have multiple instance (either static or dynamic scaling)?

Because one EBS can only attach to one instance, if I have multiple instance, does it mean that I have to attach an EBS volume for each instance? If that's the case, the data on each Instance's EBS volume will be different.

It is obvious that I want all instances to access (R & W) a single volume (as data-storage). and the data in the volume will constantly grow and there is no downtime.

What is the solution? Is there a way that I don't mount the device (EBS), and just call it for accessing the data?

Here is what I can think of:
1) if each instance has its own EBS volume, then each time interval (e.g. 1 hour), all instances will unmount & detach the EBS volume,and attach a new one. Then there is one powerful instance that mount all the EBS volumes just detached, and aggregate all the data.
2) or similar to 1), instead of detach and attach, I just take a snapshot on all volumes for all instances. Then the powerful instance aggregateness the data from the snapshot. And save the result into either another EBS or S3.

These two approach seem to be working.. but require a lot of work. is there a smarter way to approach this problem? thanks.

  • by the way, because of performance issue, I cannot have the instance writes data to S3. :)

OH how about this
3) First, all instances have their own EBS and write data into the EBS. and then each hour, data will be sent to S3. Then another instance will aggregate them.

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

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

发布评论

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

评论(2

疾风者 2024-10-21 19:04:16

拥有一个可以挂载到其他实例的 NFS 实例怎么样?

how about having ang NFS instance which can be mounted to the other instances?

慵挽 2024-10-21 19:04:16

您似乎需要为最新的 EC2 实例创建 EBS 快照。这将创建一个 EBS 支持的 AMI。然后,您需要终止所有不是最新的 EC2 实例,并从新创建的 AMI 启动新的实例堆栈。如果您正在运行负载均衡器,那么您还必须将这些新实例附加到负载均衡器。
看起来有点啰嗦,但是这一切都可以通过编程来完成。至少我认为这就是亚马逊在云中扩展的工作方式以及跨多个实例传播更改的方式。其他有更多经验的人验证了这一点。我打算稍后亲自测试一下。

It seems that you need to create an EBS snapshot of your most up to date EC2 instance. This will create an EBS backed AMI. You would then need to terminate all your EC2 instances that are not up to date and launch a new stack of instances from your newly created AMI. If you had a load balancer running then you would have to attach these new instances to your load balancer also.
It seems a little long-winded but it can all be done programmatically. At least this is how I think scaling in the cloud with Amazon works and far as propagating changes across multiple instances goes. Somebody else with more experience verify this. I plan to test it out myself later on.

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