We have a primary and standby PostgreSQL v14 server setup with streaming replication using:
pg_basebackup -h primary-server -U repuser --checkpoint=fast -D /data/db/postgresql/14/main/ -R --slot=foo -C --port=5432
We have not changed any settings in postgresql.conf
except listen_addresses
.
The streaming replication is working, all data is immediately available on the standby but the primary server is filling up it's pg_wal/
directory non-stop until the disk is full and the server crashes.
It is my understanding that streaming replication does not work by the standby reading these "WAL" files in pg_wal/
and that pg_wal/
should only contain data not yet synched. IMHO this directory should automatically empty when all replicas are in synch.
As I mentioned no default settings were changed: archive_mode
and archive_command
are commented out.
- Does streaming replication depend on this
pg_wal/
directory? - What is the correct process for preventing unfettered growth of
pg_wal/
? - Can I just switch
archive_mode
to off?
select * from pg_replication_slots;
on the primary shows the slot foo
of type physical
and state reserved
- What does the slot
foo
do and can I delete it?
UPDATE: The slot foo is active and cannot be deleted.