I have followed below documentation to configure pg_tde in RHEL 8 with PG version 16. pg_tde documentation
After enabling and configuring pg_tde key provider and master key . pg_basebackup is getting failed with below error
[postgres@hostname postgres]$ pg_basebackup -D bkp_test -R -X stream -v
pg_basebackup: initiating base backup, waiting for checkpoint to complete
pg_basebackup: checkpoint completed
pg_basebackup: write-ahead log start point: 0/14000028 on timeline 1
pg_basebackup: starting background WAL receiver
pg_basebackup: created temporary replication slot "pg_basebackup_1391250"
WARNING: aborting backup due to backend exiting before pg_backup_stop was called
pg_basebackup: error: COPY stream ended before last file was finished
pg_basebackup: removing contents of data directory "bkp_test"
In the logs I can see below error.
2024-10-18 07:55:21.132 EDT [1241049] LOG: checkpoint starting: force wait
2024-10-18 07:55:21.136 EDT [1241049] LOG: checkpoint complete: wrote 0 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.001 s, sync=0.001 s, total=0.004 s; sync files=0, longest=0.000 s, average=0.000 s; distance=16384 kB, estimate=27000 kB; lsn=0/14000060, redo lsn=0/14000028
2024-10-18 07:55:21.205 EDT [1391249] WARNING: aborting backup due to backend exiting before pg_backup_stop was called
2024-10-18 07:55:21.205 EDT [1391249] ERROR: invalid segment number 0 in file "pg_tde.map"
2024-10-18 07:55:21.205 EDT [1391249] STATEMENT: BASE_BACKUP ( LABEL 'pg_basebackup base backup', PROGRESS, WAIT 0, MANIFEST 'yes', TARGET 'client')
2024-10-18 07:55:21.221 EDT [1391250] LOG: unexpected EOF on standby connection
2024-10-18 07:55:21.221 EDT [1391250] STATEMENT: START_REPLICATION SLOT "pg_basebackup_1391250" 0/14000000 TIMELINE 1
After loading shared library pg_tde on server level and configuring master key for specific DB level, I can see below files in base directory that is creating issue. but unable to understand .
./16505/pg_tde.map
./16505/pg_tde.dat
below are the databases with OID.
test=# select oid,datname from pg_database;
oid | datname
-------+-----------
5 | postgres
1 | template1
4 | template0
16505 | test
(4 rows)
Thanks for your support team. I had to post here as I am not getting any article online for this. there might be some issue with my setup I am not sure.