Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux