I am testing one senerio releated to replication slot(Which i need to implement on PROD)
I tried to configure streaming replication with replication slot.
Master - Server-side configuration -->
max_wal_senders = 10
wal_keep_segments = 10
And Created replication slot "SELECT * FROM pg_create_physical_replication_slot('test1');"
Slave-side configuration -->
standby_mode = 'on'
primary_conninfo = 'user=postgres port=5432 sslmode=prefer sslcompression=1 krbsrvname=postgres target_session_attrs=any'
When i bring down replica and insterted near about 300MB data to check will server keep transaction files in <PGDATA>/pg_wal till replication slot become active .But files get removed when replication slot is in inactive state,Can you please explain if this is the expected ?
PG-Version - psql (PostgreSQL) 10.10
Maybe you should check two system catalogs pg_stat_replication and pg_replication_slots to make sure your streaming replication setup works properly before inserting data.
Besides, you should check both DB logs of master and standby DBs. There should be some clue on why your setting does not work.
This is not the expected behavior, if you have replication slot, it will not recycle the WAL's which are needed by the standby.
I have also tested the same on the PG 10, it holds the WAL files needed for the standby.
Could you please share the below details :
- File list in the $PGDATA/pg_wal
- The output of the select * from pg_stat_replication and select * from pg_replication_slots from the Master
- Recovery.conf file details from the standby
Then stop the standby cluster and insert some data to generate enough WAL files.
- Capture the above-mentioned details again.
Then, start the standby server and check whether it is catching up with the Master. If it is not catching up, then share the above-gathered details.