In Postgres, I want to stop the replication process on the primary. Secondary database is no more working and primary wal folder is growing in size. Can someone help me with what are the settings I should do in the postgresql.conf so that primary stop creating wal files for replication? Below are the current settings and doubts.
wal_level = logical -> Can I change to minimal? any impact?
max_wal_senders = 3 -> can I set it to 0? will it stop the whole replication work on primary
wal_keep_size = 400 -> can I reduce to 40 (MB)? Will it reduce the Wal folder size?)
max_wal_size = 1GB -> Is this the size for each replication? (or it is independant of replications)
min_wal_size = 80MB -> what is implication of this minimum value? Wal is written only if the size is 80 MB? What will be the impact if I reduce to 8 MB
Any other setting that will stop primary consuming resources for replication purpose?
And finally, what happens to current WAL files when I change these settings? Will it reduce size or just stop increasing further?
Any pointers to a suitable article/documentation will also help. Thank you
To stop replication when the standby (the subscriber) is not available, you have to drop the replication slot that belongs to the subscription:
SELECT pg_drop_replication_slot('subscription_name');
By default, the name of the replication slot is the same as the name of the subscription, but you might have chosen a different name (look at the view pg_replication_slots
).
Once the replication slot is gone, the publisher “forgets” the subscriber an will no longer retain the WAL for that subscriber.