简体   繁体   中英

Backup PostgreSQL DB from SSH to localhost

So there's a database on a dev machine server that I ssh into to write code. I want to copy the database from there to my local machine. But I can't get the following to work. Can you tell me what's wrong and where to go from here? (See image) 在此处输入图片说明

You could do the following to transfer it across with pg_dump:

ssh blau08@blau08 'pg_dump -C fieldfacts' | psql template1

This way you run pg_dump on the remote server, and direct the output to your locally-running psql. This system is effective for large databases, since it doesn't create any intermediate files, and is (relatively) fast and secure. If the database is large, compressing the output and using aes128-gcm@openssh.com may improve performance ( ssh -C -c aes128-gcm@openssh.com ... )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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