Thread: Replication err

Replication err

From
Khizer
Date:
Hi,

       I am doing streaming replication master-slave with
postgresql-9.0.4 , i am getting following err
how do i correct this


  streaming replication successfully connected to primary
2012-10-03 00:00:06 IST FATAL:  could not receive data from WAL stream:
FATAL:  requested WAL segment 000000010000000000000011 has already been
removed


Regards
Mehdi


Re: Replication err

From
Andreas Kretschmer
Date:
Khizer <khizer@srishtisoft.com> wrote:

> Hi,
>
>       I am doing streaming replication master-slave with
> postgresql-9.0.4 , i am getting following err
> how do i correct this
>
>
>  streaming replication successfully connected to primary
> 2012-10-03 00:00:06 IST FATAL:  could not receive data from WAL stream:
> FATAL:  requested WAL segment 000000010000000000000011 has already been
> removed

Increase wal_keep_segments. Default is IIRC 0, set it, for instance, to 20 or higher.


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°


Re: Replication err

From
Shaun Thomas
Date:
On 10/03/2012 12:35 AM, Khizer wrote:

>        I am doing streaming replication master-slave with
> postgresql-9.0.4 , i am getting following err
> how do i correct this

In order for replication to work, the WAL segments necessary for a slave
to "catch up" must be available long enough for them to do so. What this
error means, is that the slave requested the next WAL segment it needs,
but the master server had already recycled it. Either by sending it
elsewhere via archive_command, or by deleting it because it was no
longer needed.

You're going to have to rebuild your slave, unless you can supply it
with those missing WAL files.

One way to avoid this is to increase wal_keep_segments to a higher
number so slaves can lag behind for longer periods of time, without
needing to be rebuilt. You should also make sure you have
archive_command set, and always back up your old WAL transaction logs,
so you can reuse them in cases like this, or for emergency recovery from
the backups you're making on a regular basis.

So:

1. Rebuild your slave.
2. Increase wal_keep_segments on the master. Start at 500, but try to
set it up so there's at least enough for the slave to fall behind by an
hour and still able to catch up.
3. Make sure archive_command is set, and regularly back-up / cycle these
files for later use in recovery / standby.


--
Shaun Thomas
OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604
312-444-8534
sthomas@optionshouse.com

______________________________________________

See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email