我应该使用 EBS 还是 S3 来存储我的数据库?
我想在 Amazon EC2 实例上托管一个网站,但出于可靠性目的,我希望将底层数据库存储在一些更永久的存储介质上。不会有任何文件上传或类似的事情,但我想确保数据库查询和更新快速进行。我应该使用 EBS 还是 S3?
如果您想了解更多信息,请发表评论
I want to host a website on an Amazon EC2 instance, but for reliability purposes, I want to have the underlying database on some more permanent storage medium. There won't be any file uploading or anything like that, but I want to make sure that the database queries and updates are going quickly. Should I use EBS or S3 for this?
And just comment if you want more info
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您无法在 S3 上存储数据库。如果您打算将数据库存储在任何位置,则可以将其存储在 EBS 上或实例存储上。
You can not store a database on S3. If you intend to store your database anywhere it will either be on EBS or on instance storage.
只是为了建立在其他非常好的答案的基础上,您可以将数据库作为 .sql 文件存储在 s3 上。但是您的网站/应用程序无法查询此文件,因为 s3 没有 MySQL 程序(文件!=数据库)。
Amazon RDS 将数据库的备份作为 .sql 文件(我假设)存储到 s3,它们以编程方式访问这些文件,并在 RDS 数据库实例发生故障时使用该文件来恢复该实例。
EBS 与 RDS 的优点已在其他答案中阐述,但需要明确的是,RDS 的一个主要优点是 Amazon 通过提供备份等来负责恢复失败的实例。
不过,我不确定数据库复制部分因为这似乎是一个单独的概念,并且我读到这不是 RDS 的功能。更有经验的 DBA 似乎经常指出这一点,作为不使用 RDS 的理由。有人可以澄清一下吗?
Just to build on the other very nice answers, you can store your database as a .sql file on s3. But your website/application can't make queries to this file because s3 has no MySQL program (file!=database).
Amazon RDS stores backups of your database to s3 as .sql files (I assume) which they programmatically access and use to restore your RDS database instance in the event of its failure.
The advantages of EBS vs. RDS are stated in other answers but just to be clear, a key benefit of RDS is that Amazon takes care of restoring your failed instance by providing backups, etc.
I'm not sure about the DB replication part though as that appears to be a separate concept and I've read that this is NOT a feature of RDS. More experienced DBAs seem to point this out often as a reason NOT to use RDS. Might someone clarify this?
就像@Femi 所说,您不能使用 S3 作为数据库,但您可以使用这些实例存储/EBS/RDS 之一。更多信息如下:
如果您的实例崩溃,实例存储将会消失,+ EBS 卷最近遇到了一个很好的问题 - 虽然这比实例存储好,但我建议您看看 Amazon RDS,我有在我的一个项目中使用了它,它非常酷。
Amazon RDS 有相当好的优势:
http://aws.amazon.com/rds/
功能:
当您将 EBS 与 RDS 进行比较时,两者的费用与 RDS 相比几乎没有额外费用到EBS,但它值得。亚马逊负责一切,如果您的网站是流量驱动的,它有自动复制的解决方案。
Like, @Femi said, you can not use S3 for DB, but you can use one of these instance-store/EBS/RDS. More info below:
Instance store will disappear if your instance is crashed, + EBS volume got quite a good problem recently - though this is good over instance-store, I would suggest you to have a look at Amazon RDS, I had used it for one my project and it's super cool.
Amazon RDS has got quite a good advantages:
http://aws.amazon.com/rds/
Features:
When you compare EBS with RDS, both are charged where as little extra on RDS when compared to EBS, but its worth. Amazon takes care of everything and if your site is traffic-driven, it has got solution to replicate automatically.