agora inbox for pgsql-admin@postgresql.org
help / color / mirror / Atom feedStream pg_dumpall directly from CentOS7 to Red Hat server
12+ messages / 7 participants
[nested] [flat]
* Stream pg_dumpall directly from CentOS7 to Red Hat server
@ 2024-07-28 07:39 Wasim Devale <wasimd60@gmail.com>
0 siblings, 2 replies; 12+ messages in thread
From: Wasim Devale @ 2024-07-28 07:39 UTC (permalink / raw)
To: Pgsql-admin <pgsql-admin@lists.postgresql.org>; pgsql-admin
Hi
Can I use below command directly stream pg_dumpall from CentOS7 to RedHat 9:
pg_dumpall -U postgres | ssh postgres@redhat_ip_address "psql -U postgres"
Thanks,
Wasim
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Stream pg_dumpall directly from CentOS7 to Red Hat server
@ 2024-07-28 12:29 Laurenz Albe <laurenz.albe@cybertec.at>
parent: Wasim Devale <wasimd60@gmail.com>
1 sibling, 2 replies; 12+ messages in thread
From: Laurenz Albe @ 2024-07-28 12:29 UTC (permalink / raw)
To: Wasim Devale <wasimd60@gmail.com>; Pgsql-admin <pgsql-admin@lists.postgresql.org>; pgsql-admin
On Sun, 2024-07-28 at 13:09 +0530, Wasim Devale wrote:
> Can I use below command directly stream pg_dumpall from CentOS7 to RedHat 9:
>
> pg_dumpall -U postgres | ssh postgres@redhat_ip_address "psql -U postgres"
No idea, but the correct way is
pg_dumpall -U postgres | psql -h redhat_ip_address -U postgres
Yours,
Laurenz Albe
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Stream pg_dumpall directly from CentOS7 to Red Hat server
@ 2024-07-28 12:33 Ron Johnson <ronljohnsonjr@gmail.com>
parent: Laurenz Albe <laurenz.albe@cybertec.at>
1 sibling, 1 reply; 12+ messages in thread
From: Ron Johnson @ 2024-07-28 12:33 UTC (permalink / raw)
To: pgsql-admin
On Sun, Jul 28, 2024 at 8:30 AM Laurenz Albe <laurenz.albe@cybertec.at>
wrote:
> On Sun, 2024-07-28 at 13:09 +0530, Wasim Devale wrote:
> > Can I use below command directly stream pg_dumpall from CentOS7 to
> RedHat 9:
> >
> > pg_dumpall -U postgres | ssh postgres@redhat_ip_address "psql -U
> postgres"
>
> No idea, but the correct way is
>
> pg_dumpall -U postgres | psql -h redhat_ip_address -U postgres
>
>
The correct way, if port 5432 is open. Which isn't always the case.
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Stream pg_dumpall directly from CentOS7 to Red Hat server
@ 2024-07-28 12:35 Ron Johnson <ronljohnsonjr@gmail.com>
parent: Wasim Devale <wasimd60@gmail.com>
1 sibling, 0 replies; 12+ messages in thread
From: Ron Johnson @ 2024-07-28 12:35 UTC (permalink / raw)
To: pgsql-admin
On Sun, Jul 28, 2024 at 3:39 AM Wasim Devale <wasimd60@gmail.com> wrote:
> Hi
>
> Can I use below command directly stream pg_dumpall from CentOS7 to RedHat
> 9:
>
> pg_dumpall -U postgres | ssh postgres@redhat_ip_address "psql -U postgres"
>
That *should* work, if you can't get port 5432 open.
Nothing like testing, though, to make sure.
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Stream pg_dumpall directly from CentOS7 to Red Hat server
@ 2024-07-28 13:58 Holger Jakobs <holger@jakobs.com>
parent: Laurenz Albe <laurenz.albe@cybertec.at>
1 sibling, 1 reply; 12+ messages in thread
From: Holger Jakobs @ 2024-07-28 13:58 UTC (permalink / raw)
To: pgsql-admin@lists.postgresql.org
Am 28.07.24 um 14:29 schrieb Laurenz Albe:
> On Sun, 2024-07-28 at 13:09 +0530, Wasim Devale wrote:
>> Can I use below command directly stream pg_dumpall from CentOS7 to RedHat 9:
>>
>> pg_dumpall -U postgres | ssh postgres@redhat_ip_address "psql -U postgres"
> No idea, but the correct way is
>
> pg_dumpall -U postgres | psql -h redhat_ip_address -U postgres
>
> Yours,
> Laurenz Albe
>
This way the (old) psql tool of the current system (CentOS) would be
used. If in doubt, it's better to use the psql of the destination (Red
Hat) machine. Therefore, the idea using ssh isn't a bad one.
You could also execute the following command on the Red Hat machine:
pg_dumpall -h centos_ip_address -U postgres | psql -U postgres
This way, you'll use the newer versions of pg_dumpall and psql installed
on the Red Hat machine.
--
Holger Jakobs, Bergisch Gladbach
Attachments:
[application/pgp-signature] OpenPGP_signature (202B, ../../8453bb40-8b61-920e-58ec-1197780d7df8@jakobs.com/2-OpenPGP_signature)
download
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Stream pg_dumpall directly from CentOS7 to Red Hat server
@ 2024-07-28 17:00 Wasim Devale <wasimd60@gmail.com>
parent: Holger Jakobs <holger@jakobs.com>
0 siblings, 0 replies; 12+ messages in thread
From: Wasim Devale @ 2024-07-28 17:00 UTC (permalink / raw)
To: Holger Jakobs <holger@jakobs.com>; +Cc: pgsql-admin@lists.postgresql.org
Both major versions are the same postgresql 12.8 on CentOS7 and 12.19 on
Red hat.
Thanks,
Wasim
On Sun, 28 Jul, 2024, 7:28 pm Holger Jakobs, <holger@jakobs.com> wrote:
> Am 28.07.24 um 14:29 schrieb Laurenz Albe:
> > On Sun, 2024-07-28 at 13:09 +0530, Wasim Devale wrote:
> >> Can I use below command directly stream pg_dumpall from CentOS7 to
> RedHat 9:
> >>
> >> pg_dumpall -U postgres | ssh postgres@redhat_ip_address "psql -U
> postgres"
> > No idea, but the correct way is
> >
> > pg_dumpall -U postgres | psql -h redhat_ip_address -U postgres
> >
> > Yours,
> > Laurenz Albe
> >
> This way the (old) psql tool of the current system (CentOS) would be
> used. If in doubt, it's better to use the psql of the destination (Red
> Hat) machine. Therefore, the idea using ssh isn't a bad one.
>
> You could also execute the following command on the Red Hat machine:
>
> pg_dumpall -h centos_ip_address -U postgres | psql -U postgres
>
> This way, you'll use the newer versions of pg_dumpall and psql installed
> on the Red Hat machine.
> --
>
> Holger Jakobs, Bergisch Gladbach
>
>
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Stream pg_dumpall directly from CentOS7 to Red Hat server
@ 2024-07-29 00:48 Brock Henry <brock.henry@gmail.com>
parent: Ron Johnson <ronljohnsonjr@gmail.com>
0 siblings, 1 reply; 12+ messages in thread
From: Brock Henry @ 2024-07-29 00:48 UTC (permalink / raw)
To: pgsql-admin
I personally would create an ssh tunnel for port 5432, if ssh was open but
5432 was not.
ssh -L 5432:localhost:5432 redhat_ip_address
pg_dumpall -U postgres | psql -h localhost -U postgres
The two commands in separate windows/sessions.
On Sun, 28 Jul 2024 at 22:33, Ron Johnson <ronljohnsonjr@gmail.com> wrote:
> On Sun, Jul 28, 2024 at 8:30 AM Laurenz Albe <laurenz.albe@cybertec.at>
> wrote:
>
>> On Sun, 2024-07-28 at 13:09 +0530, Wasim Devale wrote:
>> > Can I use below command directly stream pg_dumpall from CentOS7 to
>> RedHat 9:
>> >
>> > pg_dumpall -U postgres | ssh postgres@redhat_ip_address "psql -U
>> postgres"
>>
>> No idea, but the correct way is
>>
>> pg_dumpall -U postgres | psql -h redhat_ip_address -U postgres
>>
>>
> The correct way, if port 5432 is open. Which isn't always the case.
>
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Stream pg_dumpall directly from CentOS7 to Red Hat server
@ 2024-07-29 02:11 Tom Lane <tgl@sss.pgh.pa.us>
parent: Brock Henry <brock.henry@gmail.com>
0 siblings, 2 replies; 12+ messages in thread
From: Tom Lane @ 2024-07-29 02:11 UTC (permalink / raw)
To: Brock Henry <brock.henry@gmail.com>; +Cc: pgsql-admin
Brock Henry <brock.henry@gmail.com> writes:
> I personally would create an ssh tunnel for port 5432, if ssh was open but
> 5432 was not.
+1, but I think your example is not quite right:
> ssh -L 5432:localhost:5432 redhat_ip_address
> pg_dumpall -U postgres | psql -h localhost -U postgres
If you have a local PG server, it's probably using 5432 so that ssh
can't bind to that. I think you want something like
ssh -L 5433:localhost:5432 redhat_ip_address
pg_dumpall -U postgres | psql -h localhost -p 5433 -U postgres
where "5433" can be any locally-unused port number (caution: untested;
the ssh arguments may still not be quite right).
regards, tom lane
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Stream pg_dumpall directly from CentOS7 to Red Hat server
@ 2024-07-29 02:43 Brock Henry <brock.henry@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 12+ messages in thread
From: Brock Henry @ 2024-07-29 02:43 UTC (permalink / raw)
To: tgl@sss.pgh.pa.us; +Cc: pgsql-admin
👍
Brock reacted via Gmail
<https://www.google.com/gmail/about/?utm_source=gmail-in-product&utm_medium=et&utm_campaign=e...;
On Mon, 29 July 2024, 12:11 pm Tom Lane, <tgl@sss.pgh.pa.us> wrote:
> Brock Henry <brock.henry@gmail.com> writes:
> > I personally would create an ssh tunnel for port 5432, if ssh was open
> but
> > 5432 was not.
>
> +1, but I think your example is not quite right:
>
> > ssh -L 5432:localhost:5432 redhat_ip_address
> > pg_dumpall -U postgres | psql -h localhost -U postgres
>
> If you have a local PG server, it's probably using 5432 so that ssh
> can't bind to that. I think you want something like
>
> ssh -L 5433:localhost:5432 redhat_ip_address
> pg_dumpall -U postgres | psql -h localhost -p 5433 -U postgres
>
> where "5433" can be any locally-unused port number (caution: untested;
> the ssh arguments may still not be quite right).
>
> regards, tom lane
>
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Stream pg_dumpall directly from CentOS7 to Red Hat server
@ 2024-07-29 03:12 Zaid Shabbir <zaidshabbir@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 1 reply; 12+ messages in thread
From: Zaid Shabbir @ 2024-07-29 03:12 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Brock Henry <brock.henry@gmail.com>; pgsql-admin
Hello,
One relevant question..
Is there any way to Stream pg_dumpall directly from single CentOS7 to
Multiple RHEL server directly through a single command ?
On Mon, Jul 29, 2024 at 7:12 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Brock Henry <brock.henry@gmail.com> writes:
> > I personally would create an ssh tunnel for port 5432, if ssh was open
> but
> > 5432 was not.
>
> +1, but I think your example is not quite right:
>
> > ssh -L 5432:localhost:5432 redhat_ip_address
> > pg_dumpall -U postgres | psql -h localhost -U postgres
>
> If you have a local PG server, it's probably using 5432 so that ssh
> can't bind to that. I think you want something like
>
> ssh -L 5433:localhost:5432 redhat_ip_address
> pg_dumpall -U postgres | psql -h localhost -p 5433 -U postgres
>
> where "5433" can be any locally-unused port number (caution: untested;
> the ssh arguments may still not be quite right).
>
> regards, tom lane
>
>
>
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Stream pg_dumpall directly from CentOS7 to Red Hat server
@ 2024-07-29 03:34 Ron Johnson <ronljohnsonjr@gmail.com>
parent: Zaid Shabbir <zaidshabbir@gmail.com>
0 siblings, 1 reply; 12+ messages in thread
From: Ron Johnson @ 2024-07-29 03:34 UTC (permalink / raw)
To: pgsql-admin
(Before I answer: *WHY?*)
Not intrinsically. You might be able to play weird games with ssh
tunneling, but then I'd say "find a different solution to your problem."
On Sun, Jul 28, 2024 at 11:13 PM Zaid Shabbir <zaidshabbir@gmail.com> wrote:
> Hello,
>
> One relevant question..
>
> Is there any way to Stream pg_dumpall directly from single CentOS7 to
> Multiple RHEL server directly through a single command ?
>
> On Mon, Jul 29, 2024 at 7:12 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
>> Brock Henry <brock.henry@gmail.com> writes:
>> > I personally would create an ssh tunnel for port 5432, if ssh was open
>> but
>> > 5432 was not.
>>
>> +1, but I think your example is not quite right:
>>
>> > ssh -L 5432:localhost:5432 redhat_ip_address
>> > pg_dumpall -U postgres | psql -h localhost -U postgres
>>
>> If you have a local PG server, it's probably using 5432 so that ssh
>> can't bind to that. I think you want something like
>>
>> ssh -L 5433:localhost:5432 redhat_ip_address
>> pg_dumpall -U postgres | psql -h localhost -p 5433 -U postgres
>>
>> where "5433" can be any locally-unused port number (caution: untested;
>> the ssh arguments may still not be quite right).
>>
>> regards, tom lane
>>
>>
>>
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: Stream pg_dumpall directly from CentOS7 to Red Hat server
@ 2024-07-29 18:00 Wasim Devale <wasimd60@gmail.com>
parent: Ron Johnson <ronljohnsonjr@gmail.com>
0 siblings, 0 replies; 12+ messages in thread
From: Wasim Devale @ 2024-07-29 18:00 UTC (permalink / raw)
To: Ron Johnson <ronljohnsonjr@gmail.com>; +Cc: pgsql-admin
Thanks everyone for your valuable inputs
On Mon, 29 Jul, 2024, 9:04 am Ron Johnson, <ronljohnsonjr@gmail.com> wrote:
> (Before I answer: *WHY?*)
>
> Not intrinsically. You might be able to play weird games with ssh
> tunneling, but then I'd say "find a different solution to your problem."
>
> On Sun, Jul 28, 2024 at 11:13 PM Zaid Shabbir <zaidshabbir@gmail.com>
> wrote:
>
>> Hello,
>>
>> One relevant question..
>>
>> Is there any way to Stream pg_dumpall directly from single CentOS7 to
>> Multiple RHEL server directly through a single command ?
>>
>> On Mon, Jul 29, 2024 at 7:12 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>
>>> Brock Henry <brock.henry@gmail.com> writes:
>>> > I personally would create an ssh tunnel for port 5432, if ssh was open
>>> but
>>> > 5432 was not.
>>>
>>> +1, but I think your example is not quite right:
>>>
>>> > ssh -L 5432:localhost:5432 redhat_ip_address
>>> > pg_dumpall -U postgres | psql -h localhost -U postgres
>>>
>>> If you have a local PG server, it's probably using 5432 so that ssh
>>> can't bind to that. I think you want something like
>>>
>>> ssh -L 5433:localhost:5432 redhat_ip_address
>>> pg_dumpall -U postgres | psql -h localhost -p 5433 -U postgres
>>>
>>> where "5433" can be any locally-unused port number (caution: untested;
>>> the ssh arguments may still not be quite right).
>>>
>>> regards, tom lane
>>>
>>>
>>>
^ permalink raw reply [nested|flat] 12+ messages in thread
end of thread, other threads:[~2024-07-29 18:00 UTC | newest]
Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-07-28 07:39 Stream pg_dumpall directly from CentOS7 to Red Hat server Wasim Devale <wasimd60@gmail.com>
2024-07-28 12:29 ` Laurenz Albe <laurenz.albe@cybertec.at>
2024-07-28 12:33 ` Ron Johnson <ronljohnsonjr@gmail.com>
2024-07-29 00:48 ` Brock Henry <brock.henry@gmail.com>
2024-07-29 02:11 ` Tom Lane <tgl@sss.pgh.pa.us>
2024-07-29 02:43 ` Brock Henry <brock.henry@gmail.com>
2024-07-29 03:12 ` Zaid Shabbir <zaidshabbir@gmail.com>
2024-07-29 03:34 ` Ron Johnson <ronljohnsonjr@gmail.com>
2024-07-29 18:00 ` Wasim Devale <wasimd60@gmail.com>
2024-07-28 13:58 ` Holger Jakobs <holger@jakobs.com>
2024-07-28 17:00 ` Wasim Devale <wasimd60@gmail.com>
2024-07-28 12:35 ` Ron Johnson <ronljohnsonjr@gmail.com>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox