将远程转储恢复到 RDS [英] Restore a remote dump to RDS

查看:43
本文介绍了将远程转储恢复到 RDS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果转储在我的机器中,我知道如何将 pg 转储恢复到 RDS 数据库,但是当转储在远程位置可用时,我该怎么做,比如 Amazon S3?

I know how to restore a pg dump into a RDS database if that dump is in my machine, but how could I do it when the dump is available at a remote location, say Amazon S3?

我想做的是这样的:

pg_restore -h somedomain.us-east-1.rds.amazonaws.com -p 5432 -d 数据库名称 -U 用户名 https://s3.amazonaws.com/database.dump

当然这会导致

pg_restore:[archiver] 无法打开输入文件https://s3.amazonaws.com/database.dump"

感谢您的帮助!

推荐答案

如果未指定文件名,pg_restore 将从标准输入 (doc).所以,这会起作用:

If a filename is not specified, pg_restore will take data from standard input (doc). So, this would work:

wget -O - 'https://s3.amazonaws.com/database.dump' |pg_restore -h somedomain.us-east-1.rds.amazonaws.com -p 5432 -d 数据库名称 -U 用户名

请注意,您可以创建 RDS 快照,然后从该快照创建新的数据库实例 (文档).在您的特定情况下,我不知道这是否比备份到 S3 更好,但值得一提.

Note that you can create an RDS snapshot, then create a new DB instance from that snapshot (doc). In your particular situation, I don't know if that would work better than backing up to S3, but it's worth mentioning.

这篇关于将远程转储恢复到 RDS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆