Sourabh Saha
Sourabh Saha

Reputation: 1

pg_wal getting full in Master DB

I also have a similar setup with master-slave (primary-standby) streaming replication set up on 2 physical nodes.The replication is working correctly and walsender and walreceiver both work fine.But in my case, the pg_wal in master is getting full and wal files are not being cleaned up. My archive mode is disabled. Can anyone help?

Postgres Version 12. Running on RHEL-7.8

Here is my configuration in Master Master Runtime Configuration

Here is my configuration in Streaming Replication Streaming Replication Runtime Configuration

Can someone help?

Upvotes: 0

Views: 1000

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246493

Very likely you have a stale replication slot. Look at

SELECT slot_name, active, restart_lsn
FROM pg_replication_slots;

If you find an inactive one with an old restart_lsn you have found the problem. Use the pg_drop_replication_slot function to get rid of it, then pg_wal will slowly shrink back to max_wal_size.

You should also check if you have high values in wal_keep_size (wal_keep_segments in older releases). That will also make PostgreSQL retain old WAL segments.

Upvotes: 1

Related Questions