From: | Kynn Jones <kynnjo(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to do pg_dump + pg_restore within Perl script? |
Date: | 2010-05-10 19:46:09 |
Message-ID: | AANLkTimLWokEDMryvfGB2HXGDgq05PldLyZeE9kHOzPs@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, May 10, 2010 at 1:33 PM, Greg Sabino Mullane <greg(at)turnstep(dot)com>wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
>
> > I would like to replicate the following Unix pipe within a Perl script,
> > perhaps using DBD::Pg:
> >
> >
> > % pg_dump -Z9 -Fc -U <DB_USER> <FROM_DB> | pg_restore -v -d <TO_DB> -p
> > <SSH_TUNNEL_PORT> -h localhost -U <DB_USER>
> >
> > Of course, I can try to use Perl's system, and the like, to run this pipe
> > verbatim, but I this as a last-resort approach.
> >
> > Is there a more direct way?
>
> ...
>
> If you simply want to avoid the pipes, you can think about calling pg_dump
> from the remote box, using a authorized_keys with a specific command in it,
> and other tricks...
>
I can work with pg_dump, I think. What I'm trying to avoid is the
SSH-tunneling, which I find too fragile for reliable automated operation.
My script can use DBI::connect to provide a password when connecting to the
remote host, so I can run regular SQL on the remote host via Perl DBI
without SSH-tunneling.
But I have not found a way for my script to provide a password when it
runs commands like dropdb, createdb, and pg_restore with the "-h <REMOTE
HOST>" flag. So I end up resorting to SSH-tunneling. This is what I'm
trying to avoid.
Your idea of having the remote host run the pg_dump is worth looking into,
although I'm reluctant because involving the remote host like this would
significantly complicate my whole set up.
Anyway, thanks!
~K
From | Date | Subject | |
---|---|---|---|
Next Message | Kynn Jones | 2010-05-10 20:04:16 | Re: How to do pg_dump + pg_restore within Perl script? |
Previous Message | Christoph Zwerschke | 2010-05-10 19:24:38 | Re: Finding rows with text columns beginning with other text columns |