Can WAL files be shipped to multiple servers?

Started by Steelesover 15 years ago7 messagesgeneral
Jump to latest
#1Steeles
steeles@gmail.com

I am working on shipping WAL files, can WAL files do one-to-many shipping?
The target PG instances are running in the recovery mode waiting for the WAL
files.

also, once the target PG database receives WAL files and update its own
database, can I run pg_dump to dump all the data when it is in recovery
mode?

Thanks guys.

#2Magnus Hagander
magnus@hagander.net
In reply to: Steeles (#1)
Re: Can WAL files be shipped to multiple servers?

On Fri, Jul 23, 2010 at 18:29, Steeles <steeles@gmail.com> wrote:

I am working on shipping WAL files, can WAL files do one-to-many shipping?
The target PG instances are running in the recovery mode waiting for the WAL
files.

Yes. Just copy the files to multiple machines, the slaves are
completely independent.

also, once the target PG database receives WAL files and update its own
database, can I run pg_dump to dump all the data when it is in recovery
mode?

No.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

#3Steeles
steeles@gmail.com
In reply to: Magnus Hagander (#2)
Re: Can WAL files be shipped to multiple servers?

Thanks for the quick reply.

so if I switch target database from recovery mode to normal mode and do
pg_dump to backup, then switch it back to recovery mode.

Will it break the relationship between source and target? Do I need to
re-configure it in order to receive the WAL files?

On Fri, Jul 23, 2010 at 12:31 PM, Magnus Hagander <magnus@hagander.net>wrote:

Show quoted text

On Fri, Jul 23, 2010 at 18:29, Steeles <steeles@gmail.com> wrote:

I am working on shipping WAL files, can WAL files do one-to-many

shipping?

The target PG instances are running in the recovery mode waiting for the

WAL

files.

Yes. Just copy the files to multiple machines, the slaves are
completely independent.

also, once the target PG database receives WAL files and update its own
database, can I run pg_dump to dump all the data when it is in recovery
mode?

No.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

#4Magnus Hagander
magnus@hagander.net
In reply to: Steeles (#3)
Re: Can WAL files be shipped to multiple servers?

On Fri, Jul 23, 2010 at 18:36, Steeles <steeles@gmail.com> wrote:

Thanks for the quick reply.

so if I switch target database from recovery mode to normal mode and do
pg_dump to backup, then switch it back to recovery mode.

You can't switch back.

Well, you can - by setting up the replication again from scratch,
meaning from a new base backup. That also means that if the master
crashes while you're backing up your slave, it will be out of date.

Will it break the relationship between source and target? Do I need to
re-configure it in order to receive the WAL files?

Yes.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

#5Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Magnus Hagander (#2)
Re: Can WAL files be shipped to multiple servers?

On 07/23/2010 09:31 AM, Magnus Hagander wrote:

On Fri, Jul 23, 2010 at 18:29, Steeles<steeles@gmail.com> wrote:

I am working on shipping WAL files, can WAL files do one-to-many shipping?
The target PG instances are running in the recovery mode waiting for the WAL
files.

Yes. Just copy the files to multiple machines, the slaves are
completely independent.

also, once the target PG database receives WAL files and update its own
database, can I run pg_dump to dump all the data when it is in recovery
mode?

No.

Just curious does this restriction also apply to Hot Standby in 9.0?

--
Adrian Klaver
adrian.klaver@gmail.com

#6Greg Smith
gsmith@gregsmith.com
In reply to: Steeles (#1)
Re: Can WAL files be shipped to multiple servers?

Steeles wrote:

also, once the target PG database receives WAL files and update its
own database, can I run pg_dump to dump all the data when it is in
recovery mode?

Not while it's in recovery mode. If you upgrade to the soon to be
released PostgreSQL 9.0, it's possible to bring the server up in Hot
Standby mode, which will allow pg_dump to execute against the standby.
Note that you have to be careful to tune the standby for this, as
pg_dump will act like a really long running transaction and there's a
risk of it being canceled if activity on the master conflicts with what
it's trying to dump.

--
Greg Smith 2ndQuadrant US Baltimore, MD
PostgreSQL Training, Services and Support
greg@2ndQuadrant.com www.2ndQuadrant.us

#7Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Steeles (#3)
Re: Can WAL files be shipped to multiple servers?

Excerpts from Steeles's message of vie jul 23 12:36:41 -0400 2010:

Thanks for the quick reply.

so if I switch target database from recovery mode to normal mode and do
pg_dump to backup, then switch it back to recovery mode.

The only way to switch back is to have a prior filesystem-level snapshot
before you put it in normal mode, and restore to that snapshot after
pg_dump is complete.