MySQL 下载RDS快照
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14916899/
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
download RDS snapshot
提问by William
I recently downgraded my EC2 instance. I can no longer connect to RDS. I think it might be that the internal IP is different and now the logins are attached to that specific IP. I haven't been able to figure it out. I would like to be able to get a backup from the snapshot. Is there a way to download it through AWS?
我最近降级了我的 EC2 实例。我无法再连接到 RDS。我认为可能是内部 IP 不同,现在登录名附加到该特定 IP。我一直无法弄清楚。我希望能够从快照中获取备份。有没有办法通过AWS下载它?
回答by datasage
You can't download an RDS snapshot. You can however connect to it and export your databases. Downgrading your instance should not affect connectivity unless you had set up your security groups incorrectly (Opening ports to an IP instead of another security group).
您无法下载 RDS 快照。但是,您可以连接到它并导出您的数据库。除非您错误地设置了安全组(打开到 IP 而不是另一个安全组的端口),否则降级实例不会影响连接。
回答by abguy
In addition to datasageanswer.
除了datasage答案。
As an option for production instance you can create a readonly replica in RDS and make dumps from this replica. You could avoid freezing of production DB this way.
作为生产实例的一个选项,您可以在 RDS 中创建只读副本并从此副本进行转储。您可以通过这种方式避免冻结生产数据库。
We use this scheme for PostgreSQL + pg_dump
. Hope it will be helpful to somebody else too.
我们将此方案用于 PostgreSQL + pg_dump
。希望它对其他人也有帮助。
回答by rfreytag
The accepted answer is not up-to-date anymore. Instead of using command line tools, you can use the AWS console.
接受的答案不再是最新的。您可以使用 AWS 控制台,而不是使用命令行工具。
Navigate to RDS -> Snapshots -> Manual/System ->
导航到 RDS -> 快照 -> 手册/系统 ->
Select Snapshot -> Actions -> Export to S3
选择快照 -> 操作 -> 导出到 S3
Going through S3 is common in most production environments, as you won't have direct access to the DB instance.
在大多数生产环境中,通过 S3 是很常见的,因为您无法直接访问数据库实例。
回答by Kaz
I also needed to do this so I created a dump of the db (MySQL) by logging into my app server which has permissions to access the db. I then downloaded the dump to my local machine using scp. I used:
我也需要这样做,所以我通过登录我的应用程序服务器来创建数据库(MySQL)的转储,该服务器有权访问数据库。然后我使用 scp 将转储下载到我的本地机器。我用了:
mysqldump -uroot -p -h<HOST> --single-transaction <DBNAME> > output.sql
回答by David Dehghan
Another option is to share your snapshotif you don't need to download it and just want to share it with a different AWS account ID.
回答by Java Main
It sounds like your RDS is within a VPC inside a private subnet with security group and ACL. The only way to solve your issue is to take a snapshot and cerate a new DB instance out of it within the default VPC where all connections are allowed. After that you take backup classic backup using a db client or CLI.
听起来您的 RDS 位于具有安全组和 ACL 的私有子网内的 VPC 内。解决您的问题的唯一方法是在允许所有连接的默认 VPC 内拍摄快照并从中创建一个新的数据库实例。之后,您使用数据库客户端或 CLI 进行备份经典备份。
回答by édipo Féderle
I use:
我用:
pg_dump -v -h RDS_URL -Fc -o -U username dbname > your_dump.sql
pg_dump -v -h RDS_URL -Fc -o -U username dbname > your_dump.sql