简体   繁体   English

将pg_restore与远程文件一起使用

[英]Using pg_restore with a remote file

I'm trying to use pg_restore to restore my database from a remote file stored in an amazon S3 bucket. 我正在尝试使用pg_restore从存储在Amazon S3存储桶中的远程文件还原数据库。

I tried to do this : pg_restore -c -d mydb https://myfileURL but it doesn't work, it says there is no such file or directory. 我试图这样做: pg_restore -c -d mydb https://myfileURL但它不起作用,它说没有这样的文件或目录。 The URL is fine, it's just that it can't get the file from it. 该URL很好,只是无法从中获取文件。

Which makes sense somehow but how can I do such a thing then ? 以某种方式有意义,但是那我该怎么做呢?

Perhaps there is a way to do something like this : https://myfileURL > dump.tmp and then executing pg_restore with the created file ? 也许有一种方法可以执行以下操作: https://myfileURL > dump.tmp ,然后对创建的文件执行pg_restore

Not sure if it could be a solution but I don't want to use the AWS CLI. 不知道这是否可以解决,但我不想使用AWS CLI。

Download the file first: 首先下载文件:

wget https://myfileURL -O dump.tmp
pg_restore -c -d dump.tmp

如果您使用的是PgAdmin4,我发现如果将脚本复制并粘贴到新的SQL窗口中,则会显示实际错误。

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

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