EBS 用于存储数据库与网站文件

发布于 2024-07-15 06:35:01 字数 138 浏览 8 评论 0原文

我花了一天时间第一次尝试 AWS。 我已经运行了一个 EC2 实例,并安装了一个弹性块存储 (EBS) 来保存 MySQL 数据库。

将我的 Web 应用程序文件也放在 EBS 上是否有意义,还是应该将它们部署到普通的 EC2 文件系统?

I spent the day experimenting with AWS for the first time. I've got an EC2 instance running and I mounted an Elastic Block Store (EBS) to keep the MySQL databases.

Does it make sense to also put my web application files on the EBS, or should I just deploy them to the normal EC2 file system?

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

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

发布评论

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

评论(4

夜还是长夜 2024-07-22 06:35:01

当你说你的网络应用程序文件时,我不确定你到底指的是什么。

如果您指的是已部署的代码,那么使用 EBS 可能没有意义。 您想要做的是根据先决条件创建一个 AMI,然后使用脚本来创建该 AMI 的实例并部署最新代码。 我强烈建议您自动化并测试此过程,因为很容易忘记必须在某处手动更改的某些设置。

如果您要存储由正在运行的应用程序修改的数据文件,EBS 可能有意义。 如果这类似于用户上传的图像或类似内容,您可能会发现 S3 为您提供了一个更简单的模型。

EBS 适用于:数据库、lucene 索引、基于文件的 CMS、SVN 存储库或类似的任何东西。

When you say your web application files, I'm not sure what exactly you are referring to.

If you are referring to your deployed code, it probably doesn't make sense to use EBS. What you want to do is create an AMI with your prerequisites, then have a script to create an instance of that AMI and deploy your latest code. I highly recommend you automate and test this process as it's easy to forget about some setting you have to manually change somewhere.

If you are storing data files, that are modified by the running application, EBS may make sense. If this is something like user-uploaded images or similar, you will likely find that S3 gives you a much simpler model.

EBS would be good for: databases, lucene indexes, file based CMS, SVN repository, or anything similar to that.

吃不饱 2024-07-22 06:35:01

EBS 为您提供持久存储,因此如果您的 EC2 实例发生故障,文件仍然存在。 显然他们提高了 IO 性能,但我会测试一下以确定。

EBS gives you persistent storage so if you EC2 instance fails the files still exist. Apparently their is increased IO performance but I would test it to be sure.

橘和柠 2024-07-22 06:35:01

如果您的文件会频繁更改(就像数据库一样)并且您不想继续将它们同步到 S3(或其他地方),那么 EBS 是一个不错的选择。 如果您不经常进行更改,并且可以根据需要手动(或编写脚本)同步文件,然后将它们存储在 S3 中。 如果您需要关闭或由于某种原因丢失了实例,您可以在启动新实例时将它们拉下来。
这也是假设您关心成本。 如果成本不是问题,那么使用 EBS 就不那么复杂。
我不确定您是否计划为数据库和 Web 文件建立一个单独的 EBS,但如果您只计划拥有一个 EBS 并且其上有足够的空闲空间来存放 Web 文件,那么 EBS 就不那么复杂。
如果您担心的是性能,如上所述,最好测试您的特定应用程序。

If your files are going to change frequently (like a DB does) and you don't want to keep syncing them to S3 (or somewhere else), then an EBS is a good way to go. If you make infrequent changes and you can manually (or scripted) sync the files as necessary then store them in S3. If you need to shutdown or you lose your instance for whatever reason, you can just pull them down when you start up the new instance.
This is also assuming that you care about cost. If cost is not an issue, using the EBS is less complicated.
I'm not sure if you plan on having a separate EBS for your DB and your web files but if you only plan on having one EBS and you have enough empty space on it for your web files, then again, the EBS is less complicated.
If it's performance you are worried about, as mentioned, it's best to test your particular app.

噩梦成真你也成魔 2024-07-22 06:35:01

我们的方法是在 AMI 上预部署一个脚本,从源代码控制中获取最新、最好的代码版本。 这使得快速启动新实例或更新所有正在运行的实例变得非常简单(我们一次将它们从负载平衡轮换中取出,运行脚本,然后将它们放回轮换中)。

更新:

从字里行间看,您似乎正在将单独的 EBS 卷安装到实例存储支持的实例。 AWS 最近推出了 EBS 支持的实例,与旧的实例存储实例相比,它具有很多优势。 不过,我仍然将 MySQL 数据挂载在单独的 EBS 分区上,以便在需要时可以轻松地将其挂载到不同的服务器上。

我强烈建议使用 EBS 支持的实例,并为 MySQL 数据提供单独的 EBS 卷。

Our approach is to have a script pre-deployed on our AMI that fetches the latest and greatest version of the code from source control. That makes it very straightforward to launch new instances quickly, or update all running instances (we take them out of the load balancing rotation one at a time, run the script, and put them back in the rotation).

UPDATE:

Reading between the lines it looks like you're mounting a separate EBS volume to an instance-store backed instance. AWS recently introduced EBS backed instances that have a ton of benefits vs. the old instance-store ones. I still mount my MySQL data on a separate EBS partition, though, so that I can easily mount it to a different server if needed.

I strongly suggest an EBS backed instance with a separate EBS volume for the MySQL data.

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