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

2020-04-07 Thread Laurenz Albe
On Tue, 2020-04-07 at 12:05 +0300, Andrus wrote: > > About your third question, you *never* manually mess with the files in > > pg_wal. > > The server does that. > > Is it OK to stop server, delete all files in pg_wal directory and re-start > server ? No. > Or should default value put back an

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

2020-04-07 Thread Andrus
Hi! About your third question, you *never* manually mess with the files in pg_wal. The server does that. Is it OK to stop server, delete all files in pg_wal directory and re-start server ? Or should default value put back and wait until server frees 1 GB disk space ? Andrus.

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

2020-04-07 Thread Laurenz Albe
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

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

2020-04-06 Thread Andrus
Hi! 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

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

2020-04-06 Thread Laurenz Albe
On Mon, 2020-04-06 at 11:47 +0300, Andrus wrote: > > That's why you use monitoring. > > Never use replication slots without monitoring replication (or at least the > > disk space on the primary). > > How to implement this automatically, without human interaction required ? > > "superuser_reserved

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

2020-04-06 Thread Andrus
Hi! Thank you. When you use replication slots, it is very important to put in place a monitoring solution to check if too much WAL is retained, and note that there is nothing able to do that natively in core Postgres. There are however multiple ways to solve this problem, like a background work

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

2020-04-06 Thread Andrus
Hi! Thank you. That's why you use monitoring. Never use replication slots without monitoring replication (or at least the disk space on the primary). How to implement this automatically, without human interaction required ? "superuser_reserved_connections" setting exists. How about implement

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

2020-04-06 Thread Michael Paquier
On Mon, Apr 06, 2020 at 11:03:20AM +0300, Andrus wrote: > If slave stops responing, master server will create files in pg_wal directory. > If disk becomes full, master server crashes also. > > How to avoid this ? > > If disk is nearly full, master should stop additional files creation > (and mayb

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

2020-04-06 Thread Laurenz Albe
On Mon, 2020-04-06 at 11:03 +0300, Andrus wrote: > Streaming asynchronous binary replication is used with hot standby slave. > > If slave stops responing, master server will create files in pg_wal directory. > If disk becomes full, master server crashes also. > > How to avoid this ? > > If disk

How to prevent master server crash if hot standby stops

2020-04-06 Thread Andrus
Hi! Streaming asynchronous binary replication is used with hot standby slave. If slave stops responing, master server will create files in pg_wal directory. If disk becomes full, master server crashes also. How to avoid this ? If disk is nearly full, master should stop additional files creatio