Re: setting for keep_wal_segments with replication slots, postgresql 9.4

From: Payal Singh <payal(at)omniti(dot)com>
To: John Scalia <jayknowsunix(at)gmail(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: setting for keep_wal_segments with replication slots, postgresql 9.4
Date: 2016-09-07 14:53:18
Message-ID: CANUg7LAgah3fFUi4zwTkqw_4oJq2z+ZsCahE-fVCc9=F28x2BA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

>
> keep_wal_segments is a minimum setting when replication slots are used,
> and in the event communications are lost, the number may grow as the slave
> still needs them. The growth may be such that it could fill up a
> filesystem, so precautions should be made by monitoring or having a way to
> redirect those segments to another growth area.

Correct. Always good to have some minimum number of wal files at any time,
hence why wal_keep_segments is mention in that section.

Payal Singh,
Database Administrator,
OmniTI Computer Consulting Inc.
Phone: 240.646.0770 x 253

On Wed, Sep 7, 2016 at 10:37 AM, John Scalia <jayknowsunix(at)gmail(dot)com> wrote:

> Just to reiterate what you've explained, my understanding is now that
> keep_wal_segments is a minimum setting when replication slots are used, and
> in the event communications are lost, the number may grow as the slave
> still needs them. The growth may be such that it could fill up a
> filesystem, so precautions should be made by monitoring or having a way to
> redirect those segments to another growth area. My original thinking this
> morning was more likely the keep_wal_segments settings was a maximum not a
> minimum. Thanks for clearing that up for me.
>
>
> On Wed, Sep 7, 2016 at 9:14 AM, Payal Singh <payal(at)omniti(dot)com> wrote:
>
>> Then, the second paragraph begins "In lieu of using replication slots...
>>> use keep_wal_segments"
>>
>>
>> This is talking about using keep_wal_segments to always have certain
>> minimum number of WALs even if replication is up-to-date and doesn't need
>> those WALs anymore.
>>
>> Also, if the slot is managing the storage of WAL segments, then isn't
>>> there a possibility of filling up a disk in the event of an outage?
>>
>>
>> Yes, which is why you should have disk alerts set in place and a quick
>> way to redirect WAL files to another machine, possibly one that stores
>> backups.
>>
>> And would keep_wal_segments prevent that?
>>
>>
>> No. If slave is out, slots will keep all WALs irrespective of what the
>> wal_keep_segments is set to. So in a way, wal_keep_segments value is the
>> lowest minimum number of WALs you will have on master at any moment, and
>> with slots it is possible that number will increase if slave goes down.
>>
>> Payal Singh,
>> Database Administrator,
>> OmniTI Computer Consulting Inc.
>> Phone: 240.646.0770 x 253
>>
>> On Wed, Sep 7, 2016 at 9:12 AM, John Scalia <jayknowsunix(at)gmail(dot)com>
>> wrote:
>>
>>> Hi all,
>>>
>>> I've been reading section 25.2.6 Replication Slots in the docs, and I'm
>>> just a little confused. This section clearly states that replication slots
>>> automates the management of WAL slots so the master will not remove them
>>> prior to receipt by all standbys. Then, the second paragraph begins "In
>>> lieu of using replication slots... use keep_wal_segments". So, if I have a
>>> primary-standby cluster using a replication slot, then what, if anything,
>>> should keep_wal_segments be set to? Should I just comment it out?
>>>
>>> Also, if the slot is managing the storage of WAL segments, then isn't
>>> there a possibility of filling up a disk in the event of an outage? And
>>> would keep_wal_segments prevent that? This whole section just seems to be a
>>> little vague to me and like it wasn't updated cleanly since slots were
>>> envisioned.
>>>
>>> Maybe it's just too early in the morning for me :-)
>>> Jay
>>>
>>
>>
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Gunnar "Nick" Bluth 2016-09-11 19:58:52 Re: Index bloat? Try pgindexrebuild, a production friendly index debloater
Previous Message John Scalia 2016-09-07 14:37:38 Re: setting for keep_wal_segments with replication slots, postgresql 9.4