Amazon RDS 与带有 MySQL 的 EC2 的各自优势/限制是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4806272/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What are the respective advantages/limitations of Amazon RDS vs. EC2 with MySQL?
提问by Macgyver
I realize a couple of basic differences between the two, i.e.
我意识到两者之间的一些基本差异,即
EC2 is going to be cheaper
RDS I wouldn't have to do maintenance
EC2 会更便宜
RDS 我不需要做维护
Other than those two, are there any advantages to running my database from RDS as opposed to a separate EC2 server acting as a MySQL server. Assuming similar instance sizes, are both going to run into the same limitations in terms of being able to handle a load?
除了这两个之外,与充当 MySQL 服务器的单独 EC2 服务器相比,从 RDS 运行我的数据库是否有任何优势。假设实例大小相似,两者在处理负载方面是否会遇到相同的限制?
To give you a little bit more info about my use, I've got a database, nothing too big or anything (biggest table 1 million rows), just high SELECT volume.
为了给你更多关于我使用的信息,我有一个数据库,没有太大或任何东西(最大的表有 100 万行),只有高 SELECT 卷。
回答by efalcao
This is a simple question with a very complicated answer!
这是一个很简单的问题,答案却很复杂!
In short: EC2 will provide maximum performance if you go with a RAID0 EBS. Doing RAID0 EBS requires a pretty significant amount of maintenance overhead, for example:
简而言之:如果您使用 RAID0 EBS,EC2 将提供最高性能。执行 RAID0 EBS 需要大量的维护开销,例如:
http://alestic.com/2009/06/ec2-ebs-raid
http://alestic.com/2009/06/ec2-ebs-raid
http://alestic.com/2009/09/ec2-consistent-snapshot
http://alestic.com/2009/09/ec2-consistent-snapshot
EC2 without RAID0 EBS will provide crappy I/O performance, thus it's not even really an option.
没有 RAID0 EBS 的 EC2 将提供糟糕的 I/O 性能,因此它甚至不是一个真正的选择。
RDS will provide very good (though not maximum) performance out of the box. The management console is fantastic and it's easy to upgrade instances. High availability and read only slaves are a click away. It's REALLY awesome.
RDS 将提供非常好的(虽然不是最大的)开箱即用的性能。管理控制台很棒,升级实例很容易。只需点击一下即可实现高可用性和只读从站。真是太棒了。
Short answer: Go with RDS. Still on the fence? Go with RDS!!! if you enjoy headaches and tuning every last little bit for maximum performance, then you can consider EC2 + EBS RAID 0. Vanilla EC2 is a terrible option for MySQL hosting.
简短回答:使用 RDS。还在篱笆上?和RDS一起去!!!如果您喜欢头疼的事,并且每时每刻都在调整以获得最佳性能,那么您可以考虑 EC2 + EBS RAID 0。Vanilla EC2 是 MySQL 托管的一个糟糕选择。
回答by Andres
In this postthere is an excellent benchmark between:
在这篇文章中,有一个很好的基准测试:
- Running MySql on a Small EC2 + EBS
- Running MySql on a Small EC2 + EBS + adjusted MySql parameters
- A Small RDS
- 在小型 EC2 + EBS 上运行 MySql
- 在小型 EC2 + EBS 上运行 MySql + 调整后的 MySql 参数
- 一个小RDS
The benchmark is very good since it is not focused only in ideal conditions (only one thread) but also in more realistic scenarios, with 50 threads hitting the database.
基准测试非常好,因为它不仅关注理想条件(只有一个线程),而且关注更现实的场景,有 50 个线程访问数据库。
回答by Jeff Whiting
RDS is not really a high availability system. Read the fine print in the RDS faq. During a failover event it can take up to 3 minutes to failover. Additional amazon will decide it needs to "upgrade" your rds instance and do a failover at that point which will take your database down for "up to 3 minutes" (our experience is that it can take a longer than that).
RDS 并不是真正的高可用性系统。阅读 RDS 常见问题解答中的细则。在故障转移事件期间,故障转移最多可能需要 3 分钟。其他亚马逊将决定它需要“升级”您的 rds 实例并在那时进行故障转移,这将使您的数据库停机“最多 3 分钟”(我们的经验是它可能需要更长的时间)。
RDS high availability is very different than master - master or master - slave replication and is much slower. They don't use mysql replication but uses some kind of ebs replication. So in a failover situation it will mount the ebs on the backup machine, start mysql, wait for mysql to do failure recover (hopefully nothing got corrupted too bad), then do a dns switch.
RDS 高可用与主-主或主-从复制有很大不同,而且速度要慢得多。他们不使用 mysql 复制,而是使用某种 ebs 复制。因此,在故障转移情况下,它将在备份机器上挂载 ebs,启动 mysql,等待 mysql 进行故障恢复(希望没有损坏太严重),然后进行 dns 切换。
I hope this helps you with you evaluation.
我希望这可以帮助您进行评估。
回答by DavidJ
We chose to use EC2 MySQL instances because we have a high read volume and need master-slave replication. Of course, you can spin up multiple RDS instances and setup MySQL replication between them yourself, but we use Scalr.net, which manages that for you using EC2 instances.
我们选择使用 EC2 MySQL 实例是因为我们的读取量很大,需要主从复制。当然,您可以自己启动多个 RDS 实例并在它们之间设置 MySQL 复制,但我们使用 Scalr.net,它使用 EC2 实例为您管理。
Basically, we just tell Scalr how many MySQL instances we want at it keeps them up, automates the setup of replication, handles automatic failover of slave promotion to master if the master gets terminated etc. It does both SQL dump backups and EBS volume snapshots of the master. So, when it needs to create a new slave, it automatically temporarily mounts an EBS volume of the last master snapshot to initialize the slave DB, then starts replication from the appropriate point. All point and click :) (and no, I don't work for Scalr or anything. Scalr is available as Open Source if you don't want to use their service)
基本上,我们只是告诉 Scalr 我们想要多少 MySQL 实例让它们保持运行,自动设置复制,如果主服务器终止,处理从服务器升级到主服务器的自动故障转移等。它同时执行 SQL 转储备份和 EBS 卷快照大师。所以,当它需要创建一个新的slave时,它会自动临时挂载上一个master快照的EBS卷来初始化slave DB,然后从合适的点开始复制。所有指向并单击:)(不,我不为 Scalr 或任何东西工作。如果您不想使用他们的服务,Scalr 可以作为开源提供)
回答by Shin
Regarding the maintenance window question. If you use Multi-AZ then RDS will create a standby replica in another availability zone so that there's no down time for maintenance and you protect yourself against a zone failure.
关于维护窗口问题。如果您使用多可用区,那么 RDS 将在另一个可用区中创建一个备用副本,这样就没有停机维护时间,并且您可以保护自己免受区域故障的影响。
That's what I'm planning to do in the next week or so. Of course it's going to cost you more but I haven't worked that bit out yet.
这就是我计划在下周左右做的事情。当然,这会花费你更多,但我还没有解决。
回答by Harish Ganesan
MySQL on EC2 vs RDS MySQL
EC2 上的 MySQL 与 RDS MySQL
Advantages of MySQL on EC2Amazon EC2 Inter Region Replication
MySQL 在 EC2Amazon EC2 区域间复制上的优势
Copy Snapshots across Amazon EC2 regions
跨 Amazon EC2 区域复制快照
RAID 0 with EBS Striping in MySQL EC2
在 MySQL EC2 中使用 EBS 条带化的 RAID 0
More than 3TB of Disk space ( You will not need this for your size) can be attached on MySQL on EC2.
可以在 EC2 上的 MySQL 上附加超过 3TB 的磁盘空间(您不需要这个空间)。
Disadvantages of MySQL on EC2
MySQL 在 EC2 上的缺点
Configuration, Monitoring and Maintenance compared to RDS
与 RDS 相比的配置、监控和维护
Point in time backups available in RDS
RDS 中可用的时间点备份
IOPS lesser than RDS MySQL ( even after RAID 0) currently, 10800 with 6 disks for MySQL on EC2 whereas 12500 IOPS 16KB on RDS MySQL
IOPS 低于 RDS MySQL(即使在 RAID 0 之后),10800,EC2 上的 MySQL 6 个磁盘,而 RDS MySQL 上的 12500 IOPS 16KB
回答by Eccountable
I have been trying out RDS for a few months and here are some issues I have:
我已经尝试了几个月的 RDS,这里有一些我遇到的问题:
Using SQL profiler is tricky. Since you cannot connect profiler directly to the server, you have to run some stored procedures to create a log file that you can analyze. While they offer some suggestions about how that is done, it is far from user friendly. I would only recommend that you have a certified SQL professional do this kind of work.
while Amazon backs up your instance, you cannot restore an individual database. I have a web app with several separate customer-specific databases and my solution was to launch an EC2 instance with SQL running on it to attach to the production RDB database and import the data and then back it up on the EC2 instance. The other solution was to use a 3rd party tool that creates a massive SQL script (on the app server) that will recreate the schema and populate the data back to a restore point.
使用 SQL 探查器很棘手。由于您无法将探查器直接连接到服务器,因此您必须运行一些存储过程来创建可以分析的日志文件。虽然他们提供了一些关于如何完成的建议,但它远非用户友好。我只建议您让经过认证的 SQL 专业人员来做这种工作。
当 Amazon 备份您的实例时,您无法恢复单个数据库。我有一个包含多个单独的客户特定数据库的 Web 应用程序,我的解决方案是启动一个运行 SQL 的 EC2 实例,以附加到生产 RDB 数据库并导入数据,然后将其备份到 EC2 实例上。另一种解决方案是使用第 3 方工具创建大量 SQL 脚本(在应用服务器上),该脚本将重新创建架构并将数据填充回还原点。
回答by Tihom
I had the same question this weekend. There is a 4 hour downtime window per week for RDS where they do maintenance. RDS seemed more expensive if you can get away with a micro instance of EC2. (This is true of test instances which has minimum traffic) I also wasn't able to change the timezone of the RDS instance because I dont have permission.
这个周末我也有同样的问题。对于 RDS 进行维护,每周有 4 小时的停机时间窗口。如果您可以使用 EC2 的微型实例,那么 RDS 似乎更昂贵。(这适用于流量最小的测试实例)我也无法更改 RDS 实例的时区,因为我没有权限。
I am now actually looking at http://xeround.com/which is mysql on EC2 by another company. They do not use InnoDB, instead they have their own engine called IDG. I am just starting to investigate that but they are in BETA and will give 500MB of space.
我现在实际上正在查看http://xeround.com/,这是另一家公司在 EC2 上的 mysql。他们不使用 InnoDB,而是有自己的引擎,称为 IDG。我刚刚开始调查,但他们处于测试阶段,将提供 500MB 的空间。