Thread: WAL shipping replication server re-sync

WAL shipping replication server re-sync

From
Bosco Rama
Date:
Hey folks,

We're using PG 8.4.7 on two servers that are geographically
distant from each other.  We run WAL-shipping replication
(i.e. constant recovery mode replication) between the two
servers.  These are the only two servers involved in the
setup.  When we do the 'fail-over' to swap the master and
slave servers we perform the usual recovery trigger for
pg_standby and then wait.  The slave now becomes the master
and the master becomes the new slave.  This works great.

When the servers flip modes we have been following the
guidelines that say to clear the WAL logs and the main data
area of the slave and copy the data area of the new master
to the slave while the master is in 'backup' mode.  Given
the current size (17GB) of this data area and the bandwidth
limits of the 'inter-tubes', this takes a rather long time.
(4.5 hrs last time)

Here's my (naive?) question:  Since the two servers were
essentially 'in sync' immediately prior to the switch-
over is it possible to simply rsync the new master's data area
back to the new slave's data area without clearing the slave's
data area first?  Or is the directory and file structure
sufficiently different (even if the logical data is identical)
to preclude this?

Could this difference be alleviated by using the various 'delete
on destination' options for rsync?

TIA,
Bosco.

Re: WAL shipping replication server re-sync

From
Bruce Momjian
Date:
Bosco Rama wrote:
> Hey folks,
>
> We're using PG 8.4.7 on two servers that are geographically
> distant from each other.  We run WAL-shipping replication
> (i.e. constant recovery mode replication) between the two
> servers.  These are the only two servers involved in the
> setup.  When we do the 'fail-over' to swap the master and
> slave servers we perform the usual recovery trigger for
> pg_standby and then wait.  The slave now becomes the master
> and the master becomes the new slave.  This works great.
>
> When the servers flip modes we have been following the
> guidelines that say to clear the WAL logs and the main data
> area of the slave and copy the data area of the new master
> to the slave while the master is in 'backup' mode.  Given
> the current size (17GB) of this data area and the bandwidth
> limits of the 'inter-tubes', this takes a rather long time.
> (4.5 hrs last time)
>
> Here's my (naive?) question:  Since the two servers were
> essentially 'in sync' immediately prior to the switch-
> over is it possible to simply rsync the new master's data area
> back to the new slave's data area without clearing the slave's
> data area first?  Or is the directory and file structure
> sufficiently different (even if the logical data is identical)
> to preclude this?
>
> Could this difference be alleviated by using the various 'delete
> on destination' options for rsync?

[ late reply]

Yes, you can use rsync, but only if both db servers are shut down.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: WAL shipping replication server re-sync

From
Bruce Momjian
Date:
Bosco Rama wrote:
> Hey folks,
>
> We're using PG 8.4.7 on two servers that are geographically
> distant from each other.  We run WAL-shipping replication
> (i.e. constant recovery mode replication) between the two
> servers.  These are the only two servers involved in the
> setup.  When we do the 'fail-over' to swap the master and
> slave servers we perform the usual recovery trigger for
> pg_standby and then wait.  The slave now becomes the master
> and the master becomes the new slave.  This works great.
>
> When the servers flip modes we have been following the
> guidelines that say to clear the WAL logs and the main data
> area of the slave and copy the data area of the new master
> to the slave while the master is in 'backup' mode.  Given
> the current size (17GB) of this data area and the bandwidth
> limits of the 'inter-tubes', this takes a rather long time.
> (4.5 hrs last time)
>
> Here's my (naive?) question:  Since the two servers were
> essentially 'in sync' immediately prior to the switch-
> over is it possible to simply rsync the new master's data area
> back to the new slave's data area without clearing the slave's
> data area first?  Or is the directory and file structure
> sufficiently different (even if the logical data is identical)
> to preclude this?
>
> Could this difference be alleviated by using the various 'delete
> on destination' options for rsync?

[ late reply]

Yes, you can use rsync, but only if both db servers are shut down.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general