Back

How to dump posgres database using ssh tunnel

Use pg_dump with ssh tunnel

Step 1. db-host is accessible only from tunnel-host.com. By doing the following we can access db-host server from localhost at port 5433

ssh -L localhost:5433:db-host:5432 tunnel-user@tunnel-host.com

Step 2: Open up a new tab and execute the following. Now localhost at 5433 would act like db-host at 5432

pg_dump -f ~/Dekstop/db.sql -d postgres -h localhost -p 5433

 Reference: https://www.elliotblackburn.com/psql-pg_dump-via-ssh-tunnel/

sshposgresdatabasebackup

Latest Post

Information retrieval – Searching of text using Elasticsearch

Information retrieval is the process of obtaining relevant information resources from the collection of resources relevant to information need.

Learn more
© 2023 www.lamadly.com