将远程转储还原到RDS [英] Restore a remote dump to 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?
我想做的事情是这样的:
What I want to do is something like this:
pg_restore -h somedomain.us-east-1。 rds.amazonaws.com -p 5432 -d数据库名称-U用户名https://s3.amazonaws.com/database.dump
但是,这当然会导致
pg_restore:[存档]无法打开输入文件 https://s3.amazonaws.com /database.dump
感谢您的帮助!
推荐答案
如果未指定文件名, pg_restore
将从标准输入中获取数据(文档)。因此,这将起作用:
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快照,然后从该快照创建一个新的数据库实例( doc )。在您的特定情况下,我不知道这是否比备份到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屋!