Thread: Strategies for validating WAL-shipping replication

Strategies for validating WAL-shipping replication

From
Florian Weimer
Date:
We've set up WAL-shipping replication on one of our database servers,
and the question is whether it runs correctly.  Is there an easy way
to access some tables and see if the data matches (possibly in
single-user mode)?

Stopping replication and starting the server for real on the replica
means that we have to set up things from scratch, right?  (This is a
bit annoying because of the amount of data which has to be copied from
the master.)

--
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99

Re: Strategies for validating WAL-shipping replication

From
Guillaume Lelarge
Date:
Florian Weimer a écrit :
> We've set up WAL-shipping replication on one of our database servers,
> and the question is whether it runs correctly.  Is there an easy way
> to access some tables and see if the data matches (possibly in
> single-user mode)?
>

Nope. The only way you can look at data on a "on-recovery" server (the
log shipping slave) is to stop the recovery process.

> Stopping replication and starting the server for real on the replica
> means that we have to set up things from scratch, right?  (This is a
> bit annoying because of the amount of data which has to be copied from
> the master.)
>

Yes.


--
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com

Re: Strategies for validating WAL-shipping replication

From
wstrzalka
Date:
There is not such a possibility. However it's on TODO list:
http://wiki.postgresql.org/wiki/Todo
I'm waiting for this feature too.

I can understand your fear about the data, that you can not query for
it. I had the same :)
So script as much as you can, for the rest create a formal procedure -
then repeat it few times and check if everything is correct. After
several tries you'll believe your data are safe. I've a good comfort
level with this.
You can also check & resetup your production from time to time.


On Oct 20, 8:31 am, fwei...@bfk.de (Florian Weimer) wrote:
> We've set up WAL-shipping replication on one of our database servers,
> and the question is whether it runs correctly.  Is there an easy way
> to access some tables and see if the data matches (possibly in
> single-user mode)?
>
> Stopping replication and starting the server for real on the replica
> means that we have to set up things from scratch, right?  (This is a
> bit annoying because of the amount of data which has to be copied from
> the master.)
>
> --
> Florian Weimer                <fwei...@bfk.de>
> BFK edv-consulting GmbH      http://www.bfk.de/
> Kriegsstraße 100              tel: +49-721-96201-1
> D-76133 Karlsruhe             fax: +49-721-96201-99
>
> --
> Sent via pgsql-admin mailing list (pgsql-ad...@postgresql.org)
> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-admin


Re: Strategies for validating WAL-shipping replication

From
Simon Riggs
Date:
On Mon, 2008-10-20 at 01:08 -0700, wstrzalka wrote:
> There is not such a possibility. However it's on TODO list:
> http://wiki.postgresql.org/wiki/Todo
> I'm waiting for this feature too.
>
> I can understand your fear about the data, that you can not query for
> it.

Please test the Hot Standby patch...

--
 Simon Riggs           www.2ndQuadrant.com
 PostgreSQL Training, Services and Support


Re: Strategies for validating WAL-shipping replication

From
Alvaro Herrera
Date:
Florian Weimer wrote:
> We've set up WAL-shipping replication on one of our database servers,
> and the question is whether it runs correctly.  Is there an easy way
> to access some tables and see if the data matches (possibly in
> single-user mode)?
>
> Stopping replication and starting the server for real on the replica
> means that we have to set up things from scratch, right?  (This is a
> bit annoying because of the amount of data which has to be copied from
> the master.)

The OmniTI guys gave a talk some time ago on how they used Solaris ZFS
to create a filesystem snapshot, on which they stopped the recovery and
started postmaster.  This could run queries.  The original copy
continues running recovery, and whenever you want to "update your
slave", you stop the second postmaster, delete the snapshot, and create
a new one.

Cumbersome ...

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: Strategies for validating WAL-shipping replication

From
Simon Riggs
Date:
On Mon, 2008-10-20 at 08:31 +0200, Florian Weimer wrote:

> We've set up WAL-shipping replication on one of our database servers,
> and the question is whether it runs correctly.

There's two answers here.

The first is that the code used is exactly the same as crash recovery.
So if you trust crash recovery you should trust archive recovery, which
means WAL shipping. The differences are all about where you start and
stop WAL replay.

The second is that any form of replication requires testing.

--
 Simon Riggs           www.2ndQuadrant.com
 PostgreSQL Training, Services and Support