Restore Postgres from local dump

Hi, I’m new to fly.io

I have a postgres dump that is about 2.2GB, I made it using the dbeaver backup tool.

After doing this, I connected to wireguard and was able to access fly.io’s postgres internally.

However, when I try to restore, everything works fine at first, but after a while the connection is cut, and as a result I can’t restore the fly.io database.

pg_restore: error: error returned by PQputCopyData: server closed the connection unexpectedly

	This probably means the server terminated abnormally

	before or while processing the request.

the dump is in tar format, as it is lighter and faster to restore

Hi… If this is the legacy Fly Postgres (as opposed to the newer managed postgres) then the first step is to simply check its logs with fly logs -a db-app-name to make sure it isn’t OOMing, running out of disk space, etc.

If not, then it may just be a network limitation. A fellow user was reporting problems with a similarly sized transfer recently. Unfortunately, long-running TCP sessions are prone to getting cut pretty much anywhere along the path through the Internet, :dragon:.

I think the Postgres wire protocol was designed for LANs, originally, but I could be wrong there.

A more reliable approach is to use an Internet-oriented transfer mechanism with compression, like gzip + SFTP or rsync, and then do the pg_restore within an SSH session on the database Machine itself.

Hope this helps a little!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.