Re: How to prevent master server crash if hot standby stops

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: How to prevent master server crash if hot standby stops
Дата
Msg-id f2d2499b1d8dd8d585e046d26b1dbd4903c2ea00.camel@cybertec.at
обсуждение исходный текст
Ответ на Re: How to prevent master server crash if hot standby stops  ("Andrus" <kobruleht2@hot.ee>)
Ответы Re: How to prevent master server crash if hot standby stops
Список pgsql-general
On Tue, 2020-04-07 at 00:50 +0300, Andrus wrote:
> > If you prefer replication to fail silently, don't use replication
> > slots.  Use "wal_keep_segments" instead.
> 
> I desided to give 1 GB to wal. So I added
> 
> wal_keep_segments=60
> 
> After some time Postgres created 80 files with total size 1.3GB. 
> 
> How to fix this so that no more than 1 GB of disk space is used ?
> How to get information how may wal files are yet not processed by slave ?
> How to delete processed wal files so that 1 GB of disk space can used for some other purposes ?

"wal_keep_segments" is the number of old WAL segments the server keeps around
for the standby.  But there are also some segments that are created for future
use (the minimum is governed by "min_wal_size").

All these limits are not hard limits, the server will try to keep them
more or less.  Consider that WAL segments are created as needed, but only
removed during checkpoints.

So, about your first question, you cannot.
Always make sure that there is more disk space available.

About your second question, you also cannot do that.
The primary server has no idea which standby server needs which WAL information.
All you can tell is where the currently connected standby servers are:

  SELECT pg_walfile_name(flush_lsn) FROM pg_stat_replication;

About your third question, you *never* manually mess with the files in pg_wal.
The server does that.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




В списке pgsql-general по дате отправления:

Предыдущее
От: Laurenz Albe
Дата:
Сообщение: Re: what happens when you issue ALTER SERVER in a hot environment?
Следующее
От: "Andrus"
Дата:
Сообщение: Re: How to prevent master server crash if hot standby stops