简体   繁体   English

MySQL快照与SQL转储的优缺点

[英]Pros and cons for MySQL snapshots vs SQL dumps

What are the advantages/disadvantages of using database snapshots vs. backing up SQL dumps (from mysqldump )? 使用数据库快照与备份SQL转储(来自mysqldump )的优点/缺点是什么?

I find SQL dump files easy to backup and restore. 我发现SQL转储文件易于备份和恢复。 It seems to be much faster than using database snapshots as well so I am not sure what's the point of using snapshots when they take longer to use. 它似乎比使用数据库快照要快得多,所以我不确定使用快照时使用快照的重点是什么。

For additional context, I use MySQL 5.6 and more specifically AWS RDS Aurora (MySQL edition). 对于其他上下文,我使用MySQL 5.6,更具体地说是AWS RDS Aurora(MySQL版)。

Probably the most significant reason people use snapshots is that it can take days to import a large dump file. 人们使用快照的最重要原因可能是导入大型转储文件可能需要数天时间

Snapshots have several advantages: 快照有几个优点:

  • It's faster to create a snapshot or restore a snapshot after your database gets very large. 在数据库变得非常大之后创建快照或恢复快照会更快。 You might not yet have a database that is large enough to show this advantage. 您可能还没有足够大的数据库来显示此优势。
  • You don't need an EC2 instance to run mysqldump on, nor do you need to provision storage for the dump file. 您不需要EC2实例来运行mysqldump,也不需要为转储文件配置存储。 The snapshot infrastructure takes care of both of those for you, as you invoke a snapshot in a "serverless" manner via GUI or API. 当您通过GUI或API以“无服务器”方式调用快照时,快照基础结构会为您处理这两种情况。
  • Snapshot lifecycle management is included in the AWS console. 快照生命周期管理包含在AWS控制台中。 You can auto-expire snapshots, or save them to Glacier, etc. You can do the same with dump files, but you're kind of on your own for managing them. 您可以自动使快照过期,或将它们保存到Glacier等。您可以对转储文件执行相同操作,但您可以自行管理它们。

Dump files have advantages too: 转储文件也有优势:

  • Dumps are in human-readable files. 转储是在人类可读的文件中。 You can even use grep to search for data in a dump file. 您甚至可以使用grep搜索转储文件中的数据。
  • Dumps are more-or-less portable between platforms and MySQL versions. 转储在平台和MySQL版本之间或多或少都是可移植的。
  • Dumps are a good way to transfer data between RDS and your on-prem data center (although there's a recent announcement that RDS now supports import using Percona XtraBackups). 转储是在RDS和本地数据中心之间传输数据的好方法(尽管最近有一个声明,RDS现在支持使用Percona XtraBackups进行导入)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM