Re: Log Shipping

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Joseph Kregloh <jkregloh(at)sproutloud(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Log Shipping
Date: 2016-05-31 20:12:15
Message-ID: 20160531201215.GA896252@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Joseph Kregloh wrote:
> It is my understanding that if PostgeSQL has log shipping enabled, if for
> whatever reason it cannot ship the file the master server will hold it. But
> for how long?

Forever (which means it dies because of running out of space in the
partition containing pg_xlog).

> Secondly, I have 2 servers I ship log files to using the following script:
>
> #!/usr/local/bin/bash
>
> # Slave 1
> rsync -a $1 pgi(at)192(dot)168(dot)1(dot)105:archive/$2 < /dev/null;
>
> # Slave 2
> rsync -a $1 pg(at)192(dot)168(dot)1(dot)93:archive/$2 < /dev/null;
>
> In this case if Slave 1 is up but Slave 2 is down. It will ship the log
> file to Slave 1 but not Slave 2 and move one. Thereby Slave 2 will now be
> out of sync, correct?

You could cause the script to return failure if either of these copies
fail, and return success if once both replicas have the file
(considering that one replica might already have the file from a
previous run of your script); that way, the master will retain the file
until both replicas have it, and remove the file once both replicas have
it. Of course, you want to avoid copying the file again to the replica
that already had the file, without getting confused by a partially
written file.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeffrey.Marshall 2016-05-31 20:33:17 Re: [GENERAL] Permission Denied Error on pg_xlog/RECOVERYXLOG file
Previous Message Joseph Kregloh 2016-05-31 19:58:59 Log Shipping